Which optimizations does Hotspot apply?

Vitaly Davidovich vitalyd at gmail.com
Wed Jan 22 22:55:17 UTC 2014

You can start here:

Sent from my phone
On Jan 22, 2014 5:37 PM, "Robert Stupp" <snazy at snazy.de> wrote:

> Is there any documentation available which optimizations Hotspot can
> perform and what "collecting a garbage" object costs?
> I know that these are two completely different areas ;)
> I was inspecting whether the following code
>     for (Object o : someArrayList) { ... }
> would be faster than
>     for (int i=0, l=someArrayList.size(); i<l; i++) { Object
> o=someArrayList.get(i); }
> for RandomAccessList implementations. The challenge here is not just to
> track the CPU time spent creating & using the iterator vs. size() & get()
> calls but also track GC effort (which is at least complicated if not
> impossible due to the variety of GC configuration options).
> For example:
> - Does it help Hotspot to declare parameters/variables as "final" or can
> Hotspot identify that?
> - When does Hotspot inline method calls in general and getters/setters
> especially?
> I think such a piece of documentation (just what Hotspot can do in which
> release) would be really helpful when someone tries to optimize code - want
> to say: the question is: "Is something worth to spend time on or is this
> special situation handled by Hotspot?"
> -Robert

More information about the core-libs-dev mailing list