LUAJIT (Compiled LUA?)
Moderator: Moderators
LUAJIT (Compiled LUA?)
I know there was talk about why we couldn't implement this when Spring had just gotten lua support. Would it be more feasible to do it now? It could bring tremendous improvements to the speed of lua execution, maybe even allow an lua based scripting system to replace COB.
http://luajit.org/
http://luajit.org/
Re: LUAJIT (Compiled LUA?)
how do we know lua isn't already faster than cob? :)
Re: LUAJIT (Compiled LUA?)
The for loop was TWENTY TIMES faster in lua. No one may be allowed to forget this.
Did trepan release any stats on his work in the area?
Did trepan release any stats on his work in the area?
Re: LUAJIT (Compiled LUA?)
Was he ever working on this? Last time this discussion came up, he said it was premature and unsuitable for use in Spring. I'd be delighted if work for this is already underway! 

Re: LUAJIT (Compiled LUA?)
It is premature, and work is not underway. Sorry if I got your hopes up.
Re: LUAJIT (Compiled LUA?)
you sure he didn't say something about lua unit scripting being in the xbox patch?
I remember him talking about it recently
if unit scripts are faster, the engine will run better on older machines...
I remember him talking about it recently
if unit scripts are faster, the engine will run better on older machines...
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: LUAJIT (Compiled LUA?)
I can believe that Lua is faster than COB. Although COB may look like C, it actually runs on a virtual machine, and a rather naive one at that. I would imagine that Lua has a magical virtual machine that does things much faster, given that more people are working on it.
Out of curiosity, are there any long-term plans to replace COB with Lua?
Out of curiosity, are there any long-term plans to replace COB with Lua?
Re: LUAJIT (Compiled LUA?)
The work is not underway, it's completed, and archived.
As for performance results, raw code execution is only
part of the problem. Call-in/call-out delays, thread
management, and animation control all factor in as well.
As an example, my testing showed that I could run
100000 (10^5) thread switches per 30 game frames
(so 100000 per second), and have my frame rate go
from 380 fps to 310 fps. This required a rework of the
entire c++ lua call-in setup, a lua library customization,
and a rework of the lua side call-in management.
EDIT: corrected the switch count, was testing with
100000 threads, each with a fsleep(random(10, 50), tag)
call.
As for performance results, raw code execution is only
part of the problem. Call-in/call-out delays, thread
management, and animation control all factor in as well.
As an example, my testing showed that I could run
100000 (10^5) thread switches per 30 game frames
(so 100000 per second), and have my frame rate go
from 380 fps to 310 fps. This required a rework of the
entire c++ lua call-in setup, a lua library customization,
and a rework of the lua side call-in management.
EDIT: corrected the switch count, was testing with
100000 threads, each with a fsleep(random(10, 50), tag)
call.
Re: LUAJIT (Compiled LUA?)
Completed? I should read my #lua backlog...
Edit: eh, it's too flaky from all the disconnects I'd been having.
Edit: eh, it's too flaky from all the disconnects I'd been having.
Last edited by lurker on 06 Aug 2008, 05:08, edited 1 time in total.
Re: LUAJIT (Compiled LUA?)
Completed, as in done to the point where all COB
functionality could be replaced. I was not finished
with the animation / model rework that I had planned.
Luckily, you've got other kindly devs who seem to be
planning a rework of the animation system.
P.S. As for LuaJIT, look at its limitations; they haven't
changed since the first time I looked at it oh so long
ago.
functionality could be replaced. I was not finished
with the animation / model rework that I had planned.
Luckily, you've got other kindly devs who seem to be
planning a rework of the animation system.
P.S. As for LuaJIT, look at its limitations; they haven't
changed since the first time I looked at it oh so long
ago.
Re: LUAJIT (Compiled LUA?)
Or you could release what you have :D
>_>
<_<
>_>
<_<
Re: LUAJIT (Compiled LUA?)
Slightly OT: COB probably could be made a faster by converting the COB instructions to a better ordered set of instruction codes. Right now the VM loop switch statement is implemented by the compiler with a lot of branching, while the compiler could optimize it to use a lookup table if it gets the chance.
Re: LUAJIT (Compiled LUA?)
COB would be very easy to jit, too, but is it really that of a bottleneck?
Re: LUAJIT (Compiled LUA?)
Wow, from what it sounds like, there really is no need for JIT...
Would you expect lua script support to be feature complete by next release? I know that work on the animation support is actually proceeding pretty quickly.
Would you expect lua script support to be feature complete by next release? I know that work on the animation support is actually proceeding pretty quickly.
Re: LUAJIT (Compiled LUA?)
As long as you don't mind breaking any code that references instructions as data, which is probably 0 scripts atm.jcnossen wrote:Slightly OT: COB probably could be made a faster by converting the COB instructions to a better ordered set of instruction codes. Right now the VM loop switch statement is implemented by the compiler with a lot of branching, while the compiler could optimize it to use a lookup table if it gets the chance.