Skip to main content

Escape Analysis and Stack Allocation

3 replies [Last post]
samuelto
Offline
Joined: 2005-03-15
Points: 0

Is the performance enhancement to do stack allocation using escape analysis actually in JDK6 or not? I've seen some blog saying the escape analysis part is in JDK6, but the stack allocation optimization is pused to JDK7.

Also, is there a detailed explanation on when an object is considered escaped?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Right, stack allocation is not in JDK6 whereas EA is.

samuelto
Offline
Joined: 2005-03-15
Points: 0

Thanks for the clarification. So in JDK6 are there any optimizations (e.g. lock elimination) that are based on escape analysis? In other words, should one expect any performance improvements by adding the -XX:+DoEscapeAnalysis switch?

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Yes, e.g. lock elimination is as far as I know based on EscapeAnalysis (or maybe enabling escape analysis leads to better results), however this are speculations so I don't want to tell you wrong stuff here.

What I've seen where improvements even in code which doesn't do any synchronization or object allocation. In an cipher-benchmark enabling EscapeAnalsyis lead to 5-10% better results and this was plain integer arithmetic.

So I guess, yes, almost all code should benefit from enabling escape analysis.

lg Clemens