On Wed, 21 Dec 2022 18:50:52 GMT, Alexey Bakhtin <abakh...@openjdk.org> wrote:
> Please find a patch to improve JMX Repository.query performance > > Using ObjectName.apply() allows significantly decrease memory usage and the > number of GC cycles: > Before: > > $ java test 1000000 1000000 > Test PASSED in 8943169791 ns. > GC: G1 Young Generation getCollectionCount()=177 getCollectionTime()=118 > > > After: > > $ java test 1000000 1000000 > Test PASSED in 4808213917 ns. > GC: G1 Young Generation getCollectionCount()=88 getCollectionTime()=53 > > Private ObjectName.matchDomains() method is also updated to minimize > unnecessary memory allocation. > > All javax/management jtreg tests passed successfully. I see several issues with the proposed changes: ObjectName is not final, so I'm not sure the changes proposed to ObjectName are safe when/if a subclass is supplied. And in addition, because it's not final, you will need to make a defensive copy of the input parameter in Repository::query and do the matching against the copy. ------------- PR: https://git.openjdk.org/jdk/pull/11758