lua-users home
lua-l archive

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


While browsing through directories of interpreted languages I found the 
language "Small". Not that I would ever compare this language to Lua ;-) , 
but I read, that someone had rebuilt the Virtual machine in x86 assembler 
with the result, that it performs two time as fast as before. I had a look 
at the c source of Lua and thought about, if it would be possible to do 
such thing for Lua too. But I did not really understand all the things 
going on in the VM. In the end I think my knowledge of compiler technology 
is much too limited to do such thing by meyself - no matter I'm interested 
in this. Maybe one could make a double speed king out of the speed king 
Lua ;-)

Another thing, which came up in my mind: As far as I read all the 
functions usable from C of Lua are void type. The parameter handling is 
made Lua internally. So I thought: Could not one build a native compiler, 
by changing the VM code to not execute the Opcodes, but write down the 
executed C functions instead in a file, so that one could compile this 
with a C compiler and get a real executable? Tis can't be so hard, and if 
someone knows the internal design better than me, it would just be 1-2 new 
sourcecode files. OK - You would not get rid of hashing algorythms and all 
the other stuff, what make Lua flexible. You also can ever bytecompile 
code, because all the liblua is available, but you would have a standalone 
executable, which would make it possible to distribute Software without 
making it possible to look into - and it would be a little bit faster. 

Another point would be to find out, what the most time consuming tasks are 
while running Lua code. Is it the hashing? Could such an algorithm be 
optimized in assemble for the major platforms?

My major problem is a mix of not understanding enough of theory AND how 
Lua work internally. The source looks good, modular and optimized, but I 
don't understand too much in it - what all the little functions are about. 
etc.  ... We will see...

--------------------------------------------------------------------------------------------------------
Martin Döring, Systemtechnik (IDT)
MAN Nutzfahrzeuge AG
Dachauerstraße 667
D-80995 München

Tel.:   +49(0)89 / 1580 - 1199
Fax:   +49(0)89 / 1580 - 91-1199
E-Mail: Martin_Doering@mn.man.de