lua-users home
lua-l archive

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


On Thu, Apr 21, 2011 at 20:30, Fabien <fleutot+lua@gmail.com> wrote:
> I regularly run Lua on an embedded system (ARM9). Changing the compiler into
> a cross-compiler is easy, even in our case where we had to modify the
> bytecode format (to allow execution from flash).
> As for gains linked to precompiling:
>
> with a bit of tuning you can run the bytecode straight from flash, thus
> saving some RAM
> Lua itself use very little stack space (coroutine stacks are allocated in
> the heap). The compiler, however, can consume quite a lot of stack while
> generating bytecode, typically much more than the bytecode will use when
> interpreted. Precompiling therefore lets us reserve less RAM for the stack.
>
> In terms of speed and storage space, there is little gain to expect,
> especially if you don't strip the debug symbols.

I recently did some measurements on our MIPS platforms. Loading
precompiled bytecode was 2.5x (unstripped) to 4x (stripped) faster
than compiling the scripts at load time. In absolute numbers this
meant that initializing a new Lua state and loading some basic modules
dropped from 140 ms to 54 ms and 34 ms respectively.

In certain cases there's a user on the other side waiting for response
so this reduction in loading time is most welcome for us.

-- 
Dirk