[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Wanted: Lua source code cruncher
- From: David Given <dg@...>
- Date: Mon, 10 Mar 2008 16:16:32 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
KHMan wrote:
[...]
> For completeness, yet another alternative that is simpler for
> self-contained executables (more popular on Win32) is embedding
> source or binary chunks and compressing it. With UPX, UCL-max is
> about gzip-6, plus new versions of UPX has LZMA, suitable for
> contemporary desktop machines. For the developer, no extra code
> needs to be written.
Thanks for the comments from everyone; useful stuff there. I would have
replied sooner but, well, I'm living in a hotel in Beijing right now and
the network connections are lousy (and RBL'd).
For reference: my 'application' is a shell script that compiles an
embedded Lua interpreter and runs a Lua program with it. Works very
nicely. I'm currently crunching the C side of things with cobfusc, and
LuaSrcDiet crunches the Lua side of things as well as is effective
(there's no point trying to get that any smaller since the C side is so
large; I'm now looking for a better C cruncher).
[Incidentally, you may be interested to know that running the Lua
interpreter through a sed script that converts all luaQ_ strings to just
Q (for all values of Q) knocks nearly 20kB off!]
I've investigated gzipping the relevant bits, and indeed pm comes with
an executable that does this. The savings are huge --- the executable
goes from about 300kB to 70kB --- but oddly enough that's actually
rather counterproductive. Since this is a build tool, it's normally put
in build trees that are distributed as tar.gz or tar.bz2 files; and
compressing the entire tar file works better if pm is uncompressed. That
is, compressing the C and Lua code in the executable causes the
resulting tar.bz2 to be *larger* than if it were uncompressed. I did
some measurements:
http://primemover.sourceforge.net/manual/installation.html
I've investigated luac, but not only is it non-portable but it doesn't
reduce the output nearly as much as one would expect. (For pm, it
reduces the source down to 61% --- not as much as LuaSrcDiet does.) It
*would*, however, allow me to omit the compiler from the interpreter
source... if it weren't for the fact that the Lua compiler is a key
feature of pm. Maybe for another project.
- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "Wizards get cranky, / Dark days dawn, / Riders smell manky, / The
│ road goes on. / Omens are lowering, / Elves go West; / The Shire needs
│ scouring, / You may as well quest." - John M. Ford
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH1V7ff9E0noFvlzgRAj3ZAJ9vaDfGnTargRSjfTvNOQG7JFElXQCeKD6+
64bK6iPs3NtS+MQ5g5uMnaY=
=+NzR
-----END PGP SIGNATURE-----