RFR: 6988220: java.lang.ObjectName use of String.intern() causes major performance issues at scale (original) (raw)

David Holmes david.holmes at oracle.com
Thu Feb 23 21:53:05 UTC 2012


Hi Fred,

java.lang.ObjectName? :) Need to fix that.

So often we intern strings precisely so that equals() can use == to improve performance.

It seems to me that this is a case of "fixing" something for one use-case without knowing what the impact will be on other use-cases!

Is there perhaps a solution that makes String.intern more scalable?

David

On 24/02/2012 1:36 AM, Frederic Parain wrote:

This a simple fix to solve CR 6988220: http://bugs.sun.com/bugdatabase/viewbug.do?bugid=6988220

The use of String.intern() in the ObjectName class prevents the class the scale well when more than 20K ObjectNames are managed. The fix simply removes the use of String.intern(), and uses regular String instead. The Object.equals() method is modified too to make a regular String comparison. The complexity of this method now depends on the length of the ObjectName's canonical name, and is not impacted any more by the number of ObjectName instances being handled. The Webrev: http://cr.openjdk.java.net/~fparain/6988220/webrev.00/ I've tested this fix with the jdklang and jdkmanagement test suites. Thanks, Fred



More information about the core-libs-dev mailing list