Bored this evening, I’ve not so much reinvented the wheel, as invented another way to use it.
%time php z63test.php /usr/share/dict/american-english
Normal length: 931467 bytes.
z63 length: 336720 bytes... 63% smaller!
Uncompressed length: 931467 bytes.
php z63test.php /usr/share/dict/american-english 0.28s user \
0.02s system 99% cpu 0.304 total
Yes, you’ve seen that correct. It took less than .3 seconds on my 1Ghz laptop to compress almost 1MB of data down to about a third of it’s size – into an XML compatible data format, then back into it’s original form entirely in PHP!
The system cleanly degrades; if compression won’t help, it won’t force it. It will, however, continue to encode the string, so it’s transferable via web-enabled applications.. You can even feed it binary data; it’s even unicode clean (that’s what it’s primarily designed for, enabling binary data to be safely encapsulated, with less overhead than existing schemes.)
The result speaks for itself (Note that this data is rather worthless; it’s just a free-form example):
Z63:
/usr/dict/words
2005-12-20T12:58:58-06:00
e954ccd9535d5550d8b632972b5a10ed
931467
2007-11-26T07:26:57-06:00
03a43176887b657f90eab09e177c3a7d
336720
...
Base64:
/usr/dict/words
2005-12-20T12:58:58-06:00
e954ccd9535d5550d8b632972b5a10ed
931467
2007-11-26T07:27:36-06:00
bf1ecb99327ce7fb1f7496751039ea19
1241956
...
Heck, it even compresses the front page of my website pretty well.
%time php z63test.php http://www.holwegner.com/
Normal length: 9911 bytes.
z63 length: 5077 bytes... 48% smaller!
Uncompressed length: 9911 bytes.
php z63test.php http://www.holwegner.com/ 0.03s user \
0.03s system 6% cpu 0.924 total