On Fri, Nov 26, 2010 at 10:02 PM, Mike Pall
<mikelu-1011@mike.de> wrote:
Gaspard Bucher wrote:
> > Oh well ... you've mixed up the results: the metatable variant is
> > definitely faster with LuaJIT.
>
> The metatable variant takes 341ms to run with LuaJit when it takes 1319ms
> with Lua.
$ time luajit metatable.lua
--------
connect mix1 --> mix2
mix1:input1(5)
0.010
$ time luajit closure.lua
--------
connect mix1 --> mix2
mix1.input1(5)
0.010
Actually they take less than 10ms, but you can't see that with
'time', since this is below its timing accuracy.
> Is this not "faster" enough ?
Does it matter to you how fast a mostly empty loop runs? If not,
then you're not actually measuring what you want to measure.
Drawing any conclusions from the results is a bit daring then.
> If it turns the metatable into an empty loop, why does it take longer then
> the closure version ?
It doesn't. Run them again and you'll see.
--Mike