Skip to main content

Server vs Client Results

7 replies [Last post]
Joined: 2005-11-04

I am testing inlining with very simple approach.
I am calling a method from the loop say 1000000 times manually inlined one which returns an integer, and another method which calls yet another method to get the same integer number.
Now, the results with -client mode, which is default, with jit compiler on and off there is a substatial difference. Say with jit on i would get 95 milliseconds and jit off is 5100 milliseconds which is not surprising.

But when i compare -client and -server modes, with jit disabled, i am getting 2410 vs 2500 respectively. Although it is a slight difference but still why on -server mode takes a bit longer. On contrary with jit enabled with -client mode it is much faster -server 3, client 95.

I know that -server takes longer from the start, but i don't think that is the case.

Any idea why -server takes longer disabled jit but is much faster with enabled?

Thank you

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-08-22

It looks like the runtimes are far, far too
short to do a meaningful comparison.
You are almost certainly not measuring what you
think, but rather JVM initialization and other

This is a "Beware the Microbenchmark" problem.
Probably of the "dead code elimination variety"
(Can't get Cliff's quote: "It's dead Jim!"
out of my head). [1]

With all the code snippets recently I think we
really need to start a subproject for code sharing
so people don't have to post code in the forum
or host it themselves. I'll try to get to that
next week.



[1] I'd give you the URL to the J1 session -- if it
still existed.. But, alas, the powers that be feel that
old J1 transcripts aren't worth hosting :-(

Joined: 2005-11-04

Yes, it is rather simple way.

Can i set threshold? - it might give different results

Joined: 2004-01-07

> Can i set threshold? - it might give different results

What for? It would be better to warm-up the jvm with some kind of realistic workload than to modifying teh threshold, since then profiling information is missing.

lg Clemens

Joined: 2005-11-04

Server compiler can not be slow because i am switching it off. In both cases with server and client compiler is off. So say if server mode (JIT off) produces 25003, client produces 24255 again (JIT off). I know it is a small difference but it consists on almost every run time.

I also increased loopsize.

Joined: 2006-03-01

With -server Interpreter do additional work to
collect profiling information of bytecode execution
which is used by Server JIT compiler later.
Even with -Xint when this information is not collected
Interpreter still has addtional checks.
I think, this is why you see difference with -Xint.

Joined: 2005-11-04

Thanks for your reply

Joined: 2004-01-07

1.) Hotspot compiles after after reaching a threshold, for client thats 1500 and for server 10.000

So every time you measure you also measure the time it takes to run it 1500 respectivly 10.000 times interpreted

2.) The server compiler compiles much slower, since it applies more optimizations and therefor needs more time to optimize your code.
Till code is fully compiled your program runs interpreted and is furthermore slower since the compiler itself also needs CPU.

lg Clemens