Performance of locally copied members ?

Ulf Zibis Ulf.Zibis at
Mon May 3 11:40:44 UTC 2010


in class String I often see member variables copied to local variables.
In java.nio.Buffer I don't see that (e.g. for "position" in 
nextPutIndex(int nb)).
Now I'm wondering.

 From JMM (Java-Memory-Model) I learned, that jvm can hold non-volatile 
variables in a cache for each thread, so e.g. even in CPU register for 
few ones.
 From this knowing, I don't understand, why doing the local caching 
manually in String (and many other classes), instead trusting on the JVM.

Can anybody help me in understanding this ?


More information about the core-libs-dev mailing list