3 ms·
Interesting! I looked into bsdiff, and apparently it internally uses bzip2 for compression of several components independently. As a quick hack, I modified it
by JoshTriplett 10y ago
Interesting!
I looked into bsdiff, and apparently it internally uses bzip2 for compression of several components independently. As a quick hack, I modified it to output all those pieces uncompressed (producing a large file of mostly 0s), and then tried compressing the result with various compressors, both to test other compressors, and to compress the entire file as one unit rather than as separate components.
The result ("ubsdiff" is bsdiff without compression):
85659 jquery-2.2.3.min.js
85578 jquery-2.2.4.min.js
376 jquery.bsdiff
85994 jquery.ubsdiff
264 jquery.ubsdiff.brotli
252 jquery.ubsdiff.brotli9
309 jquery.ubsdiff.bz2
403 jquery.ubsdiff.gz
360 jquery.ubsdiff.xz
So, 376 bytes for unmodified bsdiff, 309 bytes by compressing the whole uncompressed bsdiff file with bzip2, 264 bytes by compressing the whole uncompressed bsdiff file with brotli, and (strangely) 252 bytes with quality 9 brotli (the default is 11).
- JoshTriplett 10y agoTrying the same thing with a larger delta (jquery-2.2.4.min.js to jquery-3.1.0.min.js) produced different compressor rankings, though: 85578 jquery-2.2.4.min.js 86351 jquery-3.1.0.min.js 8663 jquery.bsdiff 101359 jquery.ubsdiff 8380 jquery.ubsdiff.brotli 9209 jquery.ubsdiff.brotli9 8853 jquery.ubsdiff.bz2 9550 jquery.ubsdiff.gz 8360 jquery.ubsdiff.xz In this case, bzip2 of the whole file did noticeably worse than bsdiff's compression of three separate components. brotli of the whole file still won, though. Which made me wonder if brotli of the individual components would do better than brotli of the whole file. Turns out it does: 8006 bytes.