lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Mike Pall once stated:
> Sean Conner wrote:
> >   Lua itself limits a function to around 2^17 or 2^18 constants, so I worked
> > around that limit.  Is the 65,536 limit in LuaJIT a bug, or a design
> > constaint?
> 
> LuaJIT has different limits and different design constraints.

  It's why I asked 8-)

> The short term solution is to split the table construction into
> smaller pieces, wrapped into individual functions. The long term
> solution would be to add a workaround for these limits to LuaJIT.
> But I'm not sure about the best way, yet.

  I cut the number to a quarter of the original size (I kept halving it
until LuaJIT worked), but so far, that's the *only* program I've had to
change in order to get LuaJIT to work (so it's a 99% drop-in replacement for
Lua).  

  It did cut the processing down a bit (best of three runs):

[spc]lucy:~/.intertwingle>time lua showmsg.lua >/dev/null

real    0m6.825s
user    0m6.318s
sys     0m0.508s
[spc]lucy:~/.intertwingle>time luajit showmsg.lua >/dev/null

real    0m5.881s
user    0m5.380s
sys     0m0.501s

  And, oddly enough, just making the table construction smaller made the Lua
code run faster (again, best of three runs; script with the larger table
constructions):

[spc]lucy:~/.intertwingle>time lua showmsg.lua >/dev/null

real    0m7.248s
user    0m6.759s
sys     0m0.490s

  -spc (Thanks for the clarification)