May 10, 2012

Client or Server ?

The server HotSpot VM does more or better optimizations, or both.
So, as game programming is often about maximizing performance, using the server VM would be the first choice, right ?

I did a rough comparision:
- a quadcore CPU, Windows 7, Java 7
- calling yield() from the logic game loop and no throttling whatsoever lets the framerate go through the roof

As result,
the server VM manages ~25.000 fps,
the client VM ~15.000 fps.

So, better performance at no cost ?

Let's look how the situation is on a weaker machine, or let's simply run the game on only one CPU core.
Now the tradeoff is clearly visible: the game stutters during the early HotSpot compilation phase, whereas the poor single core is easily able to manage the code compiled by the client VM - while the game is still fast enough overall and shows no stutter.

Single core, server VM: ~19.000 fps
Single core, client VM: ~11.000 fps

Now, what's the conclusion, always use the client VM for gaming ? No, as always, it depends.
But definitely test on weaker hardware as well :)

No comments:

Post a Comment