wacky micro-benchmark

charlie hunt charlie.hunt at sun.com
Tue Feb 12 06:31:52 PST 2008


Kirk,

If you haven't already discovered Sun Studio Collector / Analyzer, you 
might find it very useful for a lot of the performance work you do.  
It's free, it runs on Linux & Solaris and can be downloaded from 
http://developers.sun.com/sunstudio/downloads/.  Here's several 
additional links on using Sun Studio Collector / Analyzer:
- (Intro) http://developers.sun.com/solaris/articles/perftools.html
- (Profile Java apps) 
http://developers.sun.com/solaris/articles/javapps.html
- (Profile WebSphere) 
http://developers.sun.com/solaris/articles/profiling_websphere.html

In the absence of -XX:+PrintOptoAssembly and a fastdebug JVM, Sun 
Studio's Collector / Analyzer might give you some clues as to what's 
happening with your micro-benchmark.

If you tell Sun Studio Analyzer to present the collected information in 
machine mode, you can view the generated assembly.  I'm speculating you 
won't get as much detailed information as -XX:+PrintOptoAssembly 
though.  But, you will be able to view the generated assembly.

Disclaimer: I have not run Sun Studio Collector / Analyzer on Linux so I 
don't know if there are any limitations over what's available on Solaris 
x86 / Sparc.

hths,

charlie ...

John Rose wrote:
> Hi, Kirk.  You seem to be measuring noise.
>
> Can someone on this list please produce
> the standard URL about "10 mistakes you
> shouldn't make when playing with
> HotSpot and micro-benchmarks"?
>
> The server compiler routinely hoists
> values like a+b for you, since it uses
> global value numbering.  It is therefore
> compiling the same SSA graph in
> both cases.
>
> If you want to measure stuff like that,
> you need to look at the disassembled
> code and make sure your cases differ
> in the way you expect.  I think you'd
> be surprised (and find intriguing things
> to ponder) if you were to study the
> output code.  That's what I do when
> I'm trying to figure out what the JIT
> is thinking.
>
> If you can find or build a "fastdebug"
> version of the server JVM, run it
> with -XX:+PrintOptoAssembly.
>
> Best wishes,
> -- John
>
> P.S.  There's a Gnu-based disassembler also
> which has internally been integrated with
> HotSpot, but for various almost-forgettable
> legal reasons we cannot easily release
> it, yet.  Maybe some kind soul outside
> of Sun can re-integrate it into HotSpot as a
> hygenically factored disassembler.so.
> The flag -XX:+PrintAssembly requires
> this separate module, and when it
> works it produces truly wonderful output.
>
>
> On Feb 12, 2008, at 12:35 AM, Kirk Pepperdine wrote:
>
>>
>>     public int hoist( int a, int b) {
>>         int total = Integer.MIN_VALUE;
>>         int hoisted = a + b;
>>         for ( int i = 0; i < LOOP_COUNT; i++)
>>             total += hoisted;
>>         return total;
>>     }
>>
>>     public int nonHoist( int a, int b) {
>>         int total = Integer.MIN_VALUE;
>>         for ( int i = 0; i < LOOP_COUNT; i++)
>>             total += (a + b);
>>         return total;
>>     }
>

-- 

Charlie Hunt
Java Performance Engineer

<http://java.sun.com/docs/performance/>




More information about the hotspot-dev mailing list