Re: Allocation sinking in git HEAD

  • From: Geoff Leyland <geoff_leyland@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 5 Jul 2012 13:11:12 +1200

On 4/07/2012, at 10:49 AM, Mike Pall wrote:

> Francesco Abbate wrote:
>> I'm eager to test that with some numeric code, I will probably
>> post some results!
> Please do!

I updated a raytrace benchmark to use vector objects, rather than go to some 
trouble to avoid them, which makes the code nicer, but imposes abstraction 
costs.  The "old" version is available at [1] and the "new" version at [2].  A 
C implementation is also available.  Best of 3 times:

C: 3.5s
luajit ray-stack.lua: 7.1s
luajit ray-object.lua: 14.6s
luajit -O-sink ray-object.lua: 43.2s
lua ray-stack.lua: 231s
lua ray-object.lua: 492s

So, not quite as fast as C, the vector abstraction still costs, but allocation 
sinking makes a big difference to this cost!

For the other benchmarky code I have, allocation sinking doesn't seem to make 
much difference:

 - Revised simplex: C 4s, LJ 5.5s, Lua > 500s.  There aren't many allocations 
in this to sink.
 - kdtree: LJ: 45s, Lua: 145s.  I wrote this to avoid small tables and I think 
there are few allocations that can be avoided.  It uses closures so many traces 
 - binary and skew heap: LJ: 39s, Lua: 140s.  Most small allocations can't be 
avoided.  Most trace aborts are from call unroll limits.



Other related posts: