lua-users home
lua-l archive

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


Geoff Leyland wrote:
> 
> What fraction of the total run time or time per frame is spent in
> Lua?  Could plain Lua be quicker than you think?
> 
> Cheers,
> Geoff

In an attempt to evaluate this condition, I had already run the
following code in the rendering loop (i.e., every frame):

for x=1, 1000 do
   font:print(x)
end

Which pulled the framerate down to about 10 fps (extremely below what
we're currently experiencing), so we know the majority of the time is
being spent in that loop. However, your statement led me to re-evaluate
the loop in consideration that the majority of the work might be during
the actual drawing code, instead of the Lua code (that should be fairly
obvious, actually, and I feel pretty sheepish for not thinking of that
originally).

After adding the following code into the rendering loop:
for x = 1, 10000000 do end

I can see the difference as 20 FPS with JIT off and nearly 200 FPS with
JIT on, so it's definitely working. I guess the other tests I made
simply do not have enough time in Lua. This is not surprising, as we're
still in early stages, so it will be interesting to see how it plays out
in the long run.

Thanks for convincing me to re-evaluate my tests :)

======

Matthew P. Del Buono