lua-users home
lua-l archive

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


On Monday 25 July 2005 04.40, ouli wrote:
> 
>     I've read things like "Lua is faster than Java ".

I believe it is, if you compare under fair circumstances; ie similar 
implementations or similar hardware. The Lua VM is more effective by 
design.


>     But I found 
>     that many Benchmarks point java is faster than lua. It is
>     really?

There are several different implementations of Java, and some compile 
to native code on some platforms. This eliminates the instruction 
decoding overhead and thus, eliminates Java's VM disadvantage, and 
perhaps increases performance a little beyond that as well, depending 
on the implementation.


>     How can i improve performance with lua?

Implement a JIT for the platform(s) you're interested in...? :-)

A Lua-to-C compiler, along with a good optimizing C compiler, would 
probably be an easier way, though it may not be viable depending on 
your application. (Obviously, users can't change your scripts if 
they're pre-compiled to native code.) There is always the option of 
including a C compiler with your application, but load/compile times 
would still be much longer than with plain Lua. You can probably come 
up with a hybrid approach that fits the bill exactly.


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---