Clone wiki

Doboz / Home

Doboz

Doboz is a small data compression library written in C++ with very high decompression speed and close to zlib compression ratio. The decompression speed is typically between 700-1200 MB/s on an Intel Core i7-620M processor. However, compression is quite slow: about 2-3 MB/s. Both compression and decompression are memory safe. Doboz is distributed under the zlib/libpng license.

Warning: Doboz is not yet thoroughly tested. Use it at your own risk!

Comparison

Doboz is one of the fastest decompressors available. Here are some comparisons to QuickLZ 1.5.0 and zlib 1.25:

FileLibrarySizeComp. SizeComp. RatioComp. SpeedDecomp. Speed
concrete_DM.ddsDoboz1365 KB693 KB50.8%2.8 MB/s724.0 MB/s
concrete_DM.ddsQuickLZ1365 KB732 KB53.6%25.6 MB/s558.4 MB/s
concrete_DM.ddszlib1365 KB567 KB41.5%1.4 MB/s227.4 MB/s
gdb.exeDoboz8664 KB2979 KB34.4%2.6 MB/s698.0 MB/s
gdb.exeQuickLZ8664 KB3478 KB40.2%31.0 MB/s491.0 MB/s
gdb.exezlib8664 KB2882 KB33.3%2.9 MB/s218.3 MB/s
mesa-7.10.1.tarDoboz51470 KB7847 KB15.2%2.6 MB/s1158.0 MB/s
mesa-7.10.1.tarQuickLZ51470 KB10074 KB19.6%44.2 MB/s775.2 MB/s
mesa-7.10.1.tarzlib51470 KB8375 KB16.3%12.0 MB/s346.7 MB/s
sewer.fbxDoboz2099 KB444 KB21.2%3.1 MB/s1168.6 MB/s
sewer.fbxQuickLZ2099 KB532 KB25.3%49.5 MB/s836.5 MB/s
sewer.fbxzlib2099 KB405 KB19.3%2.7 MB/s346.3 MB/s
sponza.objDoboz21707 KB5408 KB24.9%2.1 MB/s930.4 MB/s
sponza.objQuickLZ21707 KB7073 KB32.6%36.4 MB/s606.7 MB/s
sponza.objzlib21707 KB5299 KB24.4%4.5 MB/s272.5 MB/s

All libraries were set to their maximum compression level and memory safety was enabled. The measurements were performed on an Intel Core i7-620M processor. The code was compiled for x86-64 with Visual C++ 2010 SP1.

The table shows that Doboz outperforms all the other libraries in decompression speed. It is more than 3x faster than zlib! Usually, the achieved compression ratios are slightly worse than those of zlib, but in some cases Doboz is better.

Usage

Compression

char* inputBuffer = ...
size_t inputSize = ...
size_t outputBufferSize = static_cast<size_t>(doboz::Compressor::getMaxCompressedSize(inputSize));
char* outputBuffer = new char[outputBufferSize];
size_t outputSize;
doboz::Compressor compressor;
doboz::Result result = compressor.compress(inputBuffer, inputSize, outputBuffer, outputBufferSize, outputSize);
if (result != doboz::RESULT_OK)
    return false;


Decompression

char* inputBuffer = ...
size_t inputSize = ...
doboz::Decompressor decompressor;
doboz::CompressionInfo compressionInfo;
doboz::Result result = decompressor.getCompressionInfo(inputBuffer, inputSize, compressionInfo);
if (result != doboz::RESULT_OK)
    return false;
size_t outputSize = static_cast<size_t>(compressionInfo.uncompressedSize);
char* outputBuffer = new char[outputSize];
result = decompressor.decompress(inputBuffer, inputSize, outputBuffer, outputSize);
if (result != doboz::RESULT_OK)
    return false;

Updated