HHH-12340 BasicTypeRegistry would benefit from string interning

This commit is contained in:
Sanne Grinovero 2018-03-01 20:31:56 +00:00
parent f31e4acc03
commit a77c4081f7
1 changed files with 4 additions and 0 deletions

View File

@ -142,6 +142,10 @@ public class BasicTypeRegistry implements Serializable {
if ( key == null ) {
continue;
}
//Use String#intern here as there's high chances of duplicates combined with long term usage:
//just running our testsuite would generate 210,000 instances for the String "java.lang.Class" alone.
//Incidentally this might help with map lookup efficiency too.
key = key.intern();
LOG.debugf( "Adding type registration %s -> %s", key, type );
final Type old = registry.put( key, type );
if ( old != null && old != type ) {