Enhanced loop in Tiger

What annoys me is that all the performance optimism and clever compiler tricks quoted about Java are all based on the server VM. The client VM just sucks, really :frowning:

Cas :slight_smile:

Well not ALL the clever tricks, but certainly the expensive optimization ones are server only.

I still think its wacky that they too it out of the JRE. i never noticed because I ALWAYS install a JDK.

I’ll do some digging on it but I suspect some brilliant person decided that “only GUI users download the JRE and they don’t need server” which as PC points out is not a good assumption.

Perhaps related to this mess?

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=announcements;action=display;num=1078053186

It certainly seems that someone in marketing is keen to fork <*> java.

<*> (the similarity between this and another f word is rather appropriate here I think)

[quote]The client VM just sucks, really :frowning:
[/quote]
That’s over-generalized and therefore simply not true. Eclipse, for example, runs much better (read: faster) on a client VM than on a server VM. For whatever reason…

It sucks for what we want, which is high-performance games that can compete with C++ :slight_smile:

Eclipse runs faster with the server VM - it just needs a little tuning.

Cas :slight_smile:

try to run this


public class Bench
{
   public static void main(String[] args)
   {
      long time = System.currentTimeMillis();
      int x = 0;
      for (int i = 0;i<1000000000;i++)
      {
         x+=5;
         x+=10;
      }
      System.out.println(x);
      System.out.println((System.currentTimeMillis()-time)/1000f);
   }
}

with the client and server vm (1.5). it’s amazing.
time client vm : 8 seconds on a 1 ghz pentium 3.
server vm : 0.01 (!!!) seconds

It is conceivable the server VM processes that loop completely and turns it into a single instruction…
not particularly useful in the real world maybe but you never know :slight_smile:

Cas :slight_smile:

Maybe simply, the server vm is smart enough to remove completely the loop as the result can be calculated with a simple multiplication… that is 1000000000 * 15… Can even add the result directly in the print statement…
I bet that if you get the loop count from… mhhh commandline, you will not get the same results in server VM… You then finally bench the timer granularity …

Not an amazing performance, but a nice optimization…

corrections… can’t type…

Probably has more to do with the JIT. AFAIK, the server VM is much more proactive at determining which methods it should JIT compile. Whereas the client VM waits until it actually sees a hotspot before it compiles.

Try moving the code into a method, calling it a couple of times, THEN perform the benchmark. This should give the client VM time to compile the method, if this is indeed what’s happening.