Docs for allocation sinking optimization

  • From: Mike Pall <mike-1207@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 11 Jul 2012 17:59:57 +0200

More than you ever wanted to know on how allocation sinking and
store sinking actually works can be found here:

I've included the results for the 'Point Class' benchmarks between
Lua, LuaJIT (-O-sink and -O+sink), Java and C++.

Actually, I couldn't coerce Java into eliminating the allocations
for this benchmark. I tried with the latest JVM/Hotspot 1.7.0_05
and with various options or rearrangement of the code -- none of
this helped. And -XX:+PrintGC shows the GC grinding like mad.

I'd be grateful, if anyone could point me to 1) a mistake in the
Java code or 2) an option that would allow Hotspot to eliminate
the temporary allocations.

If that's not the case, then Java is really 6x slower than LuaJIT
or C++ on this benchmark.

Which is kind of sad. I mean ... Java is the king of temporary
allocations. You'd think they'd found a way to eliminate most of
them by now, no?

[And, yes: the optimization I've worked on would be applicable to
Java, too, of course.]


Other related posts: