Hotspot performance

A few days ago Kohsuke Kawaguchi posted a really cool blog entry titled a "Deep dive into assembly code from Java". It's a pile of fascinating (if gory) assembly code with commentary. Some things to notice:
  • Really aggressive inlining
  • Even storage allocation & initialization gets inlined - new T() really is as efficient as C's alloca() (and it beats the pants off malloc())
  • Careful management of cache prefetching
  • Deep understanding of variablity between the flavors of x86 machines
  • Loop unrolling with warmup/cooldown
  • "theorum proving away" of array index checks (and many other things)
  • much cleverness with locks
I've had several run-ins in recent months with crusty C (and a few Fortran) programmers who say "you must be faking your benchmarks!". Nope. The HotSpot crew has done a truly great piece of work.
April 4, 2008