lua-users home
lua-l archive

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


Hi!

Am 23.07.2017 um 08:12 schröbte François Perrad:
2017-07-19 16:24 GMT+02:00 Jakub Jirutka <jakub@jirutka.cz>:

Hi,

I’m happy to announce the first release of brieflz [1] – Lua/C binding for
BriefLZ [2], small and fast open source implementation of a Lempel-Ziv
style compression algorithm by Joergen Ibsen.

BriefLZ is really very small C library, just 123 LoC compression code /
115 LoC safe decompression (or 63 LoC unsafe), and offers decent
compression ratio. Of course it can’t compete in compression ratio with
zlib or other “heavy” compression libraries, but it’s a good choice if you
need good enough compression with minimal footprint. I found that it has
much better compression ration on Lua sources than more known liblzf [3].

Just for very rough idea: 817 kiB Lua source (merged multiple sources,
with a lot of comments) compressed to 243 kiB with BriefLZ, 337 kiB with
liblzf, 207 kiB with gzip -9.

brieflz is available on LuaRocks [4] or as a tarball in the repository
[1]. Documentation in ldoc is available on [5].


Hello Jakub,

A best practice is to use `lua_getallocf` instead of the C `malloc`/`free`.
By this way, your extension uses the same allocator than the Lua
interpreter.

I'd call it better practice. Best practive IMHO would be to use `lua_newuserdata` directly to make the code exception-safe automatically.


François

Philipp