Re:Brendan Eich: WebAssembly is a game-changer
by azakai on Thursday March 10, 2016 @09:14PM
(#11264210)
I hadn't heard of XZ embedded. Might be worth measuring it, but it would be competing with native gzip in the browser, which is hard to beat on speed. But maybe better compression would be worth it?
[ Parent
| on HN ]
Re:Brendan Eich: WebAssembly is a game-changer
by corysama on Friday March 11, 2016 @03:08AM
(#11265361)
LZHAM is interesting in that area. Speed that competes with gzip and compression that competes with LZMA.
Re:Brendan Eich: WebAssembly is a game-changer
by vmorgulis on Friday March 11, 2016 @12:03PM
(#11267793)
Interesting.
It reminds me encode.ru :)
Do you know the size of the compiled code?
Re:Brendan Eich: WebAssembly is a game-changer
by corysama on Friday March 11, 2016 @01:42PM
(#11268610)
In this discussion https://news.ycombinator.com/item?id=8911369 someone quoted this page http://mattmahoney.net/dc/text.html as saying it compiles to about 150k. I can't find the current listing, but I'm on mobile :/
Btw: the author's blog talks about LZHAM quite a bit http://richg42.blogspot.com/
edit: Looks like it's up to 190k
Compression Compressed size Decompresser Total size Time (ns/byte)
Program Options enwik8 enwik9 size (zip) enwik9+prog Comp Decomp Mem Alg Note
------- ------- ---------- ----------- ----------- ----------- ----- ----- --- --- ----
lzham 1.0 -d29 -x 25,002,070 202,237,199 191,600 s 202,428,799 1096 6.6 7800 LZ77 70
xz 5.2.1--lzma2=preset=9e,dict=1GiB,lc=4,pb=0 24,703,772 197,331,816 36,752 xd 197,368,568 5876 20 6000 LZ77 73
gzip 1.3.5 -9 36,445,248 322,591,995 38,801 x 322,630,796 101 17 1.6 LZ77
Re:Brendan Eich: WebAssembly is a game-changer
by vmorgulis on Friday March 11, 2016 @03:43PM
(#11269366)
Very cool! I appreciate the details :-)
I ran a quick with the tool (xzminidec) that comes with XZ Embedded.
gcc -O3 -s -D XZ_USE_CRC64 -o xzminidec xzminidec.c xz_crc32.c xz_crc64.c xz_dec_stream.c xz_dec_lzma2.c
du -b xzminidec
19472 xzminidec
ldd xzminidec
linux-vdso.so.1 (0x00007ffe9905c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f105c83b000)
/lib64/ld-linux-x86-64.so.2 (0x000055d818666000)
du -b enwik8.zip
36445475 enwik8.zip
du -b enwik8.xz
26375764 enwik8.xz
time unzip enwik8.zip
real 0m1.023s
user 0m0.948s
sys 0m0.068s
time cat enwik8.xz | ./xzminidec > out-xz.txt
real 0m2.598s
user 0m2.504s
sys 0m0.136s
cmp enwik8 out-xz.txt
(empty)
unzip is faster but the xz decoder is very tiny and the compressed input file is smaller.
Re:Brendan Eich: WebAssembly is a game-changer
by vmorgulis on Friday March 11, 2016 @11:58AM
(#11267768)
The most interesting feature (for me) is its small size:
"Compiled code is 8–20 KiB."
zlib is heavier (about 200Ko).
It could be used to make self-extractible asm.js programs or to compress some embedded resources (like files from "--embedd", fonts, images...).