lua-users home
lua-l archive

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


Hi
 
I have been working with Lua on a PC, mainly for some initial project work. Ultimately I will want to move some of the code I have been writing to an embedded system with a Coldfire Processor (This is a Freescale, big endian CPU).
 
It got me thinking about cross compiling on the PC for the Coldfire processor, this raised a bunch of questions, see below, hopefully I can get a few answers here.
 
Q1)  What approx performance benefit should I expect in using a byte code version of a program rather than the source code version ? I did a quick test on the PC, my test program shrunk from 91k down to 59k when I ran it through luac. So that will save a few mS, just moving the file around, reading it etc. Am I correct in assuming when a Lua Src program runs, it first compiles to byte code and then once that stage completes, you would expect identical execution times between a byte code version and a source version ? So the execution time saving is just the initial one off compile time ? 
 
Q2) My first attempt at compiling went from 91k to 92k as I didnt use the -s option. I was surprised by the fact that without the -s it includes debug info in the output file. Just intrigued to know what this debug info is, and what programs use it ? Any explanation or links to read up on this ? 
 
Q3) Some Googling told me that some cross compiler programs have been attempted before. What I found looked quite old, so I am not sure how well they work with current Lua version ?  Is there a good reliable program I can be using now to achieve a PC based cross compile ? 
I havent double checked yet but I think my embedded CPU has identical C data sizes compared to a WIN32 compile, so my cross compile would just need to cope with the little endian to big endian switch.
 
Q4) I found a reference from one of the Lua authours mentioning he had thought about making cross compilation a Luac feature. This would be a useful feature for me personally, is this a likely addition for Lua V5.2 or even V5.3 ?
 
Q5) If there are no other options, I guess I could look at making my own cross compiling version, but at the moment I have no understanding of the bytecode file format. Any links please that I can read up on how this all works ?
 
Thanks for any help
 
Regards Geoff