Re: [ANN] LuaJIT Roadmap 2012/2013

  • From: Adam Strzelecki <ono@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 12 Jun 2012 00:01:32 +0200

> (...) This innovative
> approach is highly effective in avoiding temporary allocations in
> the fast paths, even under the presence of many slow paths where
> the temporary object may escape to. This approach is most
> effective for dynamic languages, but may be successfully applied
> elsewhere, when the classic techniques fail.

Just wanted to confirm whether this technique will remove heap allocations for 
this kind of block

for i = 0, 1000 -- some tight loop
        local value = model[i] * view
        gl.UniformMatrix4fv(location, 1, gl.TRUE, value.gl)
end

Where model & view are 4x4 matrices of custom FFI metatype having __mul 
operator.
https://github.com/nanoant/glua/blob/master/matrix.lua

Now this code above produces heap allocation (and deallocations) upon each 
iteration, regardless that value does not escape from the loop.
So will allocation/store sinking remove this allocation and store the temporary 
result in some fast preallocated memory like stack?

Does this technique has some limits (drawbacks)? Will stop working for long 
call chains (recursive calls)?

Cheers,
-- 
Adam Strzelecki | nanoant.com | twitter.com/nanoant


Other related posts: