The Source for Java Technology Collaboration
User: Password:



Osvaldo Pinali Doederlein

Osvaldo Pinali Doederlein's Blog

Mustang's HotSpot Client gets 58% faster!

Posted by opinali on November 10, 2005 at 09:13 AM | Comments (7)

Mustang is adding new optimizations to HotSpot, not news, we expect the JVM to learn new tricks at every release. But the great news is that Sun just added a great performance enhancement to HotSpot Client. Yep, the other HotSpot... the one that never appears in benchmarks aimed to make Java or particular JVMs look good. Unfortunately, you can't realistically use the Server VM in most client apps, from simple database front-ends to action games, as it loads slower, eats more RAM, and it's not included in the more ubiquitous JRE package.

Well, good news: Build 59 includes an improvement recorded as Bug 6320351: new register allocator for C1. ("C1" means HotSpot Client; C2 is Server.) The bug description is short, so there it goes in full: "The existing register allocator for C1 is very primitive and doesn't take very good advantage of the registers available.  It also doesn't allow values to live across blocks.  Along with the high level IR models locals in such an explicit manner that the code quality for inlining is fairly bad." A good register allocator is even more important in the Intel x86 platform because it's got so few architectural registers.

How cool is this new optimization? I tested with SciMark2, a good benchmark for that kind of stuff because it runs tight loops of complex arithmetic expressions, array access and similar operations that benefit enormously from good register allocation. Results (on Windows / Pentium-IV 2,25GHz) are:


HotSpot Client
HotSpot Server
J2SE 5.0
Update 5
168
FFT 87
SOR 308
MonteCarlo 24
Sparse matmult 116
LU 303
410
FFT 232
SOR 563
MonteCarlo 70
Sparse matmult 333
LU 853
JSE 6.0
build 58
169
FFT 87
SOR 308
MonteCarlo 40
Sparse matmult 119
LU 291
431
FFT 274
SOR 560
MonteCarlo 126
Sparse matmult 289
LU 905
JSE 6.0
build 59
267
FFT 232
SOR 563
MonteCarlo 70
Sparse matmult 333
LU 853
432
FFT 272
SOR 560
MonteCarlo 126
Sparse matmult 289
LU 910

Notice the remarkable improvement in HotSpot Client, a 58% boost over 5.0 (the best stable HotSpot) or Mustang b58 (the previous build without the new optimization). The Server VM is also improving in Mustang, but only by a modest 5% over 5.0 (that's already good enough to produce near-ideal code; SciMark2 doesn't need most new tricks of Server 6.0, from lock coarsening to the [still upcoming] benefits of escape analysis).

The improvement in the sub-tests Sparse matmult (2,9X faster) and LU factorization (2,8X faster) are even more noticeable; these two tests are heavy in array manipulation. I'm not sure why arrays improve so much, but my bet is that the better register allocation, causing fewer reloads of array and index variables, plays well with CPU optimizations like data prefetching and instruction-level parallelism.

This all spells good news for Java clients. The improved code generation is good not just for action games with sophisticated geometry calculations. Complex algorithms like Java2D's blt loops, Swing's painting and layout code, chart renders, XML parsers, middleware stacks and others, lie below our vanilla CRUD & reporting application. HotSpot Client is doomed to always lag behind Server, but Moore's Law allows to continuously package more tricks even in the JVM for low-end machines and user-time sensitive apps.


Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • One interesting thing to note is that the client JVM is actually faster than the server JVM on the "Sparse matmult" benchmark. Any ideas why?

    Posted by: mayhem on November 10, 2005 at 11:18 PM

  • You say that escape analysis is "still upcoming" but the link to escape analysis (http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html) says "the current builds of Mustang (Java SE 6) can do escape analysis"...?

    Posted by: marc_ on November 11, 2005 at 01:17 AM

  • I believe escape analysis is performed in the latest HotSpot builds, but no escape analysis related optimizations are done. Some benchmarks will see a huge improvement (10x) when these optimizations are implemented.

    Posted by: mayhem on November 11, 2005 at 03:56 AM

  • Absolutely awesome! Congratulations to all involved. May many more 58%'s be coming soon :) When is the beta due out?

    Posted by: profiler on November 11, 2005 at 04:05 AM

  • Compare the data "Hotspot Client - JSE 6.0 build 59" and "HotSpot Server - J2SE 5.0 Update 5": the detailed data are identical, while the "total performance index" is different. How should I read these numbers?

    Posted by: insac on November 11, 2005 at 05:52 AM

  • insac: LU results 910 != 905 it's marginal.

    Posted by: danielmd on November 11, 2005 at 06:08 AM

  • Insac: sorry, my mistake, Insac is right, the tables are equal is it a typo?

    Posted by: danielmd on November 11, 2005 at 06:10 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds