Which optimizations does Hotspot apply?
Andrew Haley
aph at redhat.com
Sat Jan 25 10:14:44 UTC 2014
On 01/24/2014 09:36 PM, Andrej Golovnin wrote:
> Could you please explain it a little bit more? When is that
> optimization applied, e.g. what conditions are required for this
> optimization, since which version of JDK/Hotspot it is supported,
> where it is implemented in JDK?
>
> When I take look at a product I'm working on, I see a lot instances
> of ArrayList$Itr objects, which are created by for-each loops (we
> use JDK 7u51).
Rather than asking these questions, you should have a look:
Read the bytecode javac generates.
Build a debug JVM and look at the assembly code HotSpot produces.
Turn on GC tracing and have a look.
Use a system profiling tool (e.g. oprofile) to measure the time taken.
Don't believe what anyone tells you: find out for yourself.
Then you'll know.
Andrew.
More information about the core-libs-dev
mailing list