Stop wasting your time with traditional profilers. Treat them like antivirus software; they lie all the time and they are not made to help you. Yes, they're that bad
Can somebody settle this once and for all...
JVisualVM reports that I'm generating megabytes worth of iterators every frame. This is bothering because there are other things I'd rather have room to create megabytes of every frame. However I've heard anecdotally that it is only the presence of JVisualVM's profiling that actually causes these iterators to be picked up because it turns off the escape analysis feature in the JVM.
This is true, merely the presence of an attached profiler will disable escape analysis and many other optimizations. The simplest way to identify whether EA is kicking in or not is to use JITWatch
. It's my favorite performance analysis tool these days. It doesn't require a debug VM or the disasm DLL (though disasm is highly recommended for low-level tuning). Here's a demo of the EA reporting:http://www.youtube.com/v/LK1Ain1JDlQ?version=3&hl=en_US&start=
A debug VM will tell you why
a particular allocation has not been eliminated. This is useful, but not critical for performance tuning, assuming you're familiar with the basics. Once you identify a problematic allocation, it takes a bit of refactoring to solve the problem and it's rarely an unfixable situation. Like everything else in Java, bytecode size, call depth and associated inlining decisions play the most critical role.