RFR: 8287384: Speed up jdk.test.lib.util.ForceGC
Roger Riggs
rriggs at openjdk.java.net
Tue May 31 17:53:52 UTC 2022
On Tue, 31 May 2022 17:41:08 GMT, Mandy Chung <mchung at openjdk.org> wrote:
> Hmm... one benefit of Cleaner is the ease of use to avoid the need of managing the reference queue. If the performance of the Cleaner API is a concern, perhaps we should look into reducing its overhead?
The code using a Cleaner here creates a CountDownLatch to wait on; that along with the Cleaner seems very similar to the complexity of the suggested alternative directly using a ReferenceQueue. But I'm fine with it either way
Each Cleaner creates a new OS thread, used for a single instance of ForceGC.
The caching of the Cleaner in a Static mostly reduces the per ForceGC overhead.
When Loom is a feature, a Virtual Thread would be sufficient.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8907
More information about the core-libs-dev
mailing list