[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT2 performance for number crunching
- From: Leo Razoumov <slonik.az@...>
- Date: Sun, 13 Feb 2011 11:08:15 -0500
On Sun, Feb 13, 2011 at 10:18, Mike Pall <firstname.lastname@example.org> wrote:
> Leo Razoumov wrote:
>> > In Lua we can do the same: specialize the Lua code at runtime for
>> > the number of dimensions, memoize the code in a table and dispatch
>> > based on the dimension. I.e. string.format + loadstring +
>> > memoization table.
>> It would be great if this specialize/memoize/dispatch optimization for
>> small number of dimensions could make it into LuaJIT-2.0 release.
> Umm, you misunderstood: this out of the scope of what a compiler
> automatically can or should do for you. C++ compilers don't write
> templates for you, either. :-) It's pretty easy to do it yourself
> in Lua, far easier than writing C++ templates.
Sorry for my misunderstanding but I thought that LuaJIT-2 can unroll
fixed length loops like for i=1,3 do ... end.
It is a pity that Lua does not have a concept of a constant variable
so that when I write for i=1,n do ... end I really mean that value of
n cannot change. Is there any room to hint LuaJIT about certain
logical constrains of the executing code to assist it in