wacky micro-benchmark
Kirk
kirk.pepperdine at gmail.com
Tue Feb 12 02:27:20 PST 2008
Hi John,
Thanks for your response. I was expected that both methods would produce
the same SSA graph. So I was expecting that both methods would produce
the same results. What I wasn't expecting was that the run time would
drift towards the slower end of the scale. I'm looking for a fastdebug
version of the JVM.
Kirk
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;
>> }
>
>
More information about the hotspot-dev
mailing list