On Monday 25 July 2005 09:19, David Olofson wrote: [...] > 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. I'm not sure a Lua-to-C compiler would help --- Lua's so dynamic that you can't actually convert a Lua expression into a single machine code routine. Even something as simple as "a + b" could do *anything*, depending on what types a and b were, what their metatables were defined as, the enclosing scopes, etc. All naive compilation would gain is saving the overhead of doing the instruction decode. (Which may still be worthwhile, of course --- how much overhead is there?) However, a dynamically recompiling JIT like Python's Psyco would probably make Lua fly (even more). Unfortunately, these require deep knowledge of the black arts to make work effectively... http://psyco.sourceforge.net/introduction.html -- +- David Given --McQ-+ "I don't like the thought of her hearing what I'm | dg@cowlark.com | thinking." "*No-one* likes the thought of hearing | (dg@tao-group.com) | what you're thinking." --- Firefly, _Objects in +- www.cowlark.com --+ Space_
Attachment:
pgpBlLI0L7S0i.pgp
Description: PGP signature