[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Fast loading of very large "symbol" tables
- From: David Given <dg@...>
- Date: Mon, 13 Oct 2008 01:27:48 +0100
Canute Bigler wrote:
> Thank you all for the responses so far. I had considered the route of
> compiling the script to bytecode and then embedding it as a buffer that
> I could then load. I'd not yet compared the timing difference between
> the two methods.
Loading bytecode is substantially faster than compiling source.
If you want an example, my wordgrinder app does this:
The relevant code to load the bytecode blocks is in src/c/lua.c,
script_load_from_table(), but it's pretty much trivial; of more interest
is probably tools/multibin2c.lua, which is the script that takes all
the bytecode files and turns them into the C source file that gets
compiled in to the rest of the program.
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ --- Conway's Game Of Life, in one line of APL
Description: OpenPGP digital signature