[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Discussing Lua compiling
- From: Matthew Wild <mwild1@...>
- Date: Thu, 21 Apr 2011 17:38:51 +0100
On 21 April 2011 17:28, Jeff Smith <spammealot1@live.co.uk> wrote:
> Hi
>
> 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 ?
>
Correct, and this compile time is typically very fast.
> 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 ?
>
Lua uses it to give helpful error messages. Without the debug info the
message "attempt to index local 'foo'" becomes "attempt to index a nil
value", for example.
> 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 ?
This is an excellent guide:
http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLua51VMInstructions.pdf
Regards,
Matthew