HeadlinesBriefing favicon HeadlinesBriefing.com

Why Bzip2 Still Wins for Code Compression in 2026

Hacker News •
×

A Minecraft mod developer discovered that bzip2 remains the most efficient compression algorithm for code, outperforming modern alternatives like xz and zstd. When compressing a 327 KB Lua codebase, bzip2 achieved a 63.7 KB result - significantly smaller than competitors including lzip (67.6 KB) and zstd (69.0 KB).

The key insight is that bzip2 uses Burrows-Wheeler Transform rather than LZ77, which reorders characters to group similar contexts together. This approach excels at compressing text-like data such as code with comments, where repetitive patterns appear naturally. Unlike LZ77-based methods that search for earlier occurrences, BWT simply needs to look at recent symbols.

Beyond compression ratios, bzip2 offers practical advantages for embedded use. Its decoder can be implemented in about 1.5 KB of Lua code - smaller than xz or lzip implementations while maintaining competitive performance. The algorithm's deterministic nature means no compression level tuning is required, making it ideal for self-extracting archives where code size matters more than speed.