Name.contentEquals() performance

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Oct 3 13:22:00 UTC 2018



On 03/10/18 14:16, Maurizio Cimadamore wrote:
> (That said, out of curiosity I tried to instrument the JDK build to 
> see how many names were created (this is a bit hard given that the 
> build internally reuses java compilers using the sjavac server), but 
> name creation seem to peak at around 33K, which would give an overhead 
> of a couple of hundred of kB for an extra field like the one you 
> suggest, which doesn't seem excessive in terms of footprint increase) 
Actually, now that I think more, if you store the toString() result in 
an extra field, while the footprint of the Name class (shallow size) 
won't change much (8 more bytes per instance), we could potentially be 
talking about 33K more (in the JDK build case) strings be retained by 
the javac code - which is probably going to balloon up the memory 
footprint cost significantly.

Maurizio


More information about the compiler-dev mailing list