Compression
Reduce binary size with Brotli or GZip compression.
Hakobu can compress the snapshot filesystem embedded in your binary, reducing the final executable size at the cost of slightly longer startup time.
Usage
Use the --compress flag to enable compression:
# Brotli compression (best ratio)
hakobu . --compress Brotli --output ./dist/app
# GZip compression (faster decompression)
hakobu . --compress GZip --output ./dist/app
# No compression (default)
hakobu . --compress None --output ./dist/appWithout --compress, no compression is applied.
Compression Options
| Option | Size Reduction | Startup Impact | Best For |
|---|---|---|---|
Brotli | Highest | Slower startup | Distribution, download size matters |
GZip | Moderate | Moderate | Balance of size and speed |
None | No reduction | Fastest startup | Development, CI, startup-critical apps |
Tradeoffs
Compression reduces the binary size but adds decompression overhead at startup. The snapshot must be decompressed before any application code runs.
- Brotli provides the best compression ratio but has the highest decompression cost. Choose this when binary download size is the primary concern.
- GZip offers a middle ground -- smaller than uncompressed but faster to decompress than Brotli.
- No compression gives the fastest possible startup. This is the default and is recommended when binary size is not a concern.
For most applications, the startup overhead from compression is small (tens of milliseconds). If you are distributing binaries to end users and want to minimize download size, Brotli is a good choice.