Module Compress Deflate Lua |
|
compress.deflatelua
implements DEFLATE [1] and gzip/zlib decompression in pure Lua.
Download:
Example:
It's somewhat slow (as expected). To decompress lua-5.1.4.tar.gz using bit.numberlua, it takes about 9 seconds with CRC-checking enabled (4 with LuaJIT 1.x) or 3 seconds with CRC checking disabled (2 with LuaJIT 1.x). It's faster when using native bitop libraries, particularly under LuaJit.
Why? Possible reasons include these: (1) for pedagogical reasons, (2) to benchmark Lua, (3) to bootstrap applications like LuaRocks/LuaDist that might not have a precompiled copy of gunzip, and (4) because DEFLATE has been implemented in other languages too [1] (including Python, Perl, and Lisp).
The modules above follow a somewhat Perl CPAN-like naming convention. Compare to [Compress::Zlib::Perl], [Digest::CRC32], and the Bit:: modules.
The modules are being packaged to be usable in LuaRocks and LuaDist. (I'm still working on the LuaRocks and LuaDist packaging.)
More notes here are expected later. See [compress.deflatelua github page]. Comments welcome.