lua-users home
lua-l archive

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

Mike Pall <> writes:
> Well, that's the main problem. LuaJIT is not tuned to deal with
> tons of loops that run only 2 iterations. It unrolls them, but
> there's a limit to that and this hits here.
> In C++ one would use templates for that purpose. This instantiates
> a copy of the whole code for a specific number of dimensons.
> That's not as wasteful as it sounds, since you probably only ever
> use a finite set of dimensions, e.g. dim=2 and dim=3

To be fair, gcc at least will happily unroll small fixed loops like
this, and usually does, to the extent that I've stopped trying to use
any kind of special technique, and just write the obvious loops when
programming in C++.


My books focus on timeless truths.  -- Donald Knuth