Updated 2012-11-12 03:00:17 by RLE

bzip2 is a freely available, patent-free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression. See also zip, lzma


There are Tcl bindings available for it bztcl (except they are LGPL). It would be a great addition to have a Tcl VFS backend available.

[2006-04-30] I don't see any reference to the LGPL for bztcl; is the above comment outdated?.. it seems to be 'modified BSD' license for both it and the prerequisite 'tclmore' library, and the bzip2 library itself is a BSD-style license.

See also bz2:compress and bz2:decompress

Vince -- Writing a tcl-vfs backend for bztcl shouldn't be difficult. Just copy the .zip (zipvfs.tcl) or .tar (tarvfs.tcl) backend and make the relevant changes. It's all pure Tcl....

LES: There must be some mistake above. While bzip2 is indeed the strongest compression format and produces the smallest files, I've also found it to be one of the slowest formats. It's usually twice as slow as other formats, not twice as fast.

DLR It refers to twice as fast as PPM compressors (reference ones). For day-to-day usage I find the difference in speed negligible compared to the substantial savings in space (relative to gzip compression).

LES: Hard disk drives get cheaper and space is more abundant every month. Time has only become scarcer therefore more precious ever since I was born.

KPV: Yes, but network transmission speeds are still such that the smaller size more than offsets the slower compression time, especially for offline static stuff.

DLR Yes, I routinely get about 20% savings relative to gzip, which can mean a lot if you are on a modem line or your files are big. Not the same downloading 1Gb or 800MB. Once all we have T3 data lines coming into our homes, maybe ;)

HJG And don't forget those people without a flatrate, who have to pay for their traffic-volume...

wdb By my opinion: Either compactness matters. Then take the best format available. Or it doesn't. Then, don't zip at all.