[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Wanted: Lua source code cruncher
- From: KHMan <keinhong@...>
- Date: Mon, 10 Mar 2008 01:04:14 +0800
David Given wrote:
> Luiz Henrique de Figueiredo wrote:
>>> With C, I can drastically reduce the size of the source code by using a
>>> cruncher utility: this reads in the C source and emits an equivalent but
>>> smaller source file by removing whitespace, comments, renaming locals to
>>> smaller versions, etc.
>> My lstrip does all that, except rename locals; but it's in C.
> Unfortunately lstrip isn't suitable for me, but looking it up on Google
> led me to LuaSrcDiet, which does pretty much what I want (...except
> locals); so thanks anyway.
> Runing LuaSrcDiet on pm reduces it down to 58%, which isn't bad.
> Unfortunately, once this is bolted on to the Lua interpreter source
> itself, this turns into a real reduction of the resulting binary to 95%
> - --- which is barely worth measuring.
LuaSrcDiet just whacks whitespace and comments; it doesn't really
change anything else so you should get the same binary chunk. I
did LuaSrcDiet as a fun bit of scripting, so updating it is pretty
low-priority. It's true that the biggest win to implement would be
optimizing the local names.
> variable names, but I suspect what I really need is a better C cruncher.
> It ought to be possible to Huffman encode all symbol names by creative
> use of #define. Hmm...
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia