Re: [ANN] LuaJIT Roadmap 2012/2013

  • From: Geoff Leyland <geoff_leyland@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 14 Jun 2012 10:22:42 +1200

On 14/06/2012, at 9:45 AM, Adam Strzelecki wrote:

> Thanks for clarifying that. I recall the discussion from Feb this year:
> http://lua-users.org/lists/lua-l/2012-02/msg00207.html
> where you've said that allocation sinking with native vector (& SIMD matrix) 
> types may be solution to avoid temporary allocations for matrix/vector 
> expressions.
> 
> But now it seems this isn't the case, at least not the goal of allocation 
> sinking here.
> 
> Can you please give more details then what is the main goal for upcoming 
> allocation sinking? (some sample)

I'm hoping it'll transform this:

point = {}
function point:new(x, y)
  self.__index = self
  return setmetatable({x=x, y=y}, self)
end
function point.__add(a, b)
  return point:new(a.x + b.x, a.y + b.y)
end

do
  local a, b = point:new(1, 1), point:new(2, 2)
  for i = 1, 1000 do
    a = (a + b) + b
  end
  io.stderr:write(a.x, ", ", a.y)
end

into this:

do
  local ax, ay, bx, by = 1, 1, 2, 2
  for i = 1, 1000 do
    ax = ax + bx + bx
    ay = ay + by + by
  end
  io.stderr:write(ax, ", ", ay)
end

It's not that tables are moved from the heap to the stack, it's that now there 
are no tables at all.  (and when it does I'll rewrite that raytrace benchmark 
to use point objects)



Other related posts: