There Is No Best Compression Algorithm
Optimization is a frontier, not a podium.

Imagine we’re choosing a compression algorithm for a backup system. The data will be written once, stored for several years, and perhaps never opened again. Spending an extra minute compressing it might be an entirely reasonable decision if the result occupies considerably less storage.
Now imagine we’re choosing an algorithm for an archive utility. Someone double-clicks a file, searches for a document, previews it, and closes the archive. They aren’t particularly concerned with how much computation was invested in compressing it six months ago. They’re concerned with what happens after they double-click.
These are both compression problems. They are not the same optimization problem.
In the first three articles of this series, we examined how scores can change when measurement units change, why not every possible file can be made smaller, and how experimental conditions can distort performance comparisons. Even if we resolve all three problems, we’re still left with a decision: what constitutes better compression?
That question cannot be answered by a leaderboard alone.
Two different ways to win
Suppose we have 100 MB of data and three hypothetical compression configurations. A produces 25 MB in two seconds. B produces 20 MB in eight seconds. C produces 25 MB in ten seconds.
| Configuration | Output | Encode time | Ratio |
|---|---|---|---|
| A | 25 MB | 2 s | 4× |
| B | 20 MB | 8 s | 5× |
| C | 25 MB | 10 s | 4× |
A is four times as fast as B. B produces an output 20 percent smaller than A. Neither is unambiguously superior. C, however, produces exactly the same size as A while taking five times as long. If those are the only two things we care about, and the outputs satisfy equivalent correctness and functionality requirements, there is no reason to choose C over A.
This distinction is the basis of Pareto dominance. A configuration dominates another if it is no worse on every selected objective and strictly better on at least one. The collection of configurations that are not dominated forms a Pareto frontier.
Notice what the definition doesn’t require. We don’t have to decide how many milliseconds are worth a megabyte. We don’t have to combine speed and size into a single score. We can eliminate inferior options without pretending that all remaining trade-offs have an obvious answer (Figure 1).
Fig. 01 / Interactive
Which configurations survive?
The frontier changes when we change the question
The previous comparison was deliberately incomplete. What if C decodes considerably faster than A? What if it requires a fraction of the memory? What if it supports independent access to individual blocks while A requires decoding a long sequential stream?
We may have discarded a configuration that is actually preferable for the intended application.
Dominance is a relationship defined over a set of objectives. Add another objective and a previously dominated configuration may become nondominated. Remove one and the opposite can happen. The frontier is not an intrinsic property of a codec independent of what we measure.
For an archive engine, I would want to understand compressed size, encoding time, decoding time, peak working memory, energy consumption and the cost of accessing individual entries. These are different quantities with different units. We can compare their directions directly without inventing conversion factors between them (Figure 2).
Fig. 02 / Interactive
Reveal another dimension.
There’s a subtle consequence here. Adding objectives generally makes it harder to establish dominance, and a larger proportion of configurations may survive. That doesn’t mean the analysis has failed. It means the measurements alone have not established which sacrifices we should accept.
That’s where the requirements of the application become important.
Constraints before preferences
Consider an embedded device with a strict 64 MiB memory budget. A compressor requiring 128 MiB is not a slightly worse candidate. It is an infeasible candidate, regardless of how impressive its compression ratio might be.
The same distinction applies to maximum latency, supported file formats, integrity checks, and the requirement to reconstruct the original input exactly. Some conditions are prerequisites. Others are preferences that can be traded against one another.
It makes little sense to assign a small penalty to a configuration that cannot run on the target device. We should remove configurations that fail the requirements before comparing the remaining ones (Figure 3).
Fig. 03 / Interactive
Start with the requirements.
If none of the configurations meet our requirements, that is a useful result. It tells us that the solution space needs to change. Perhaps we need a different codec, smaller independent blocks, a revised memory budget, or a different representation of the original data.
A benchmark should be capable of returning no suitable answer.
A compression algorithm is not a point
We frequently talk about algorithms as though each has one compression ratio and one throughput. In practice, a codec often exposes a range of configurations. Compression levels change search effort, window sizes, strategy, or other implementation details. Thread counts and block sizes introduce further choices.
A level number is a setting within a particular implementation, not a universal unit of effort. Level six in gzip and level six in Zstandard do not necessarily represent equivalent computation, memory requirements, or output size.
Comparing default settings answers a legitimate question about default behavior. Comparing maximum settings answers a different question about the available extremes. Neither describes the entire range of choices.
I’d rather plot the configurations themselves. We might discover that one implementation is particularly effective under a strict latency budget, while another becomes attractive only when given substantially more time. We might also discover several settings within the same codec that are dominated by other settings (Figure 4).
Fig. 04 / Interactive
Explore the settings, not just the names.
Codec X Codec Y Codec Z
There is another reason to retain the individual configurations. An archive may be decoded by software other than the original encoder. Compatibility, memory requirements and available decoding features may impose constraints that don’t appear in an encoding benchmark at all.
The choice of codec is inseparable from the choice of representation and deployment environment.
How certain are we that one point is better?
In the previous article we explored experimental variability. It matters here because a frontier is commonly computed from point estimates. Suppose two configurations produce the same output size and one has a median encoding time of 99 milliseconds while the other takes 101. A conventional dominance calculation would prefer the first.
But if repeated experiments suggest the difference is within ordinary measurement uncertainty, that conclusion may be premature.
We can use a deliberately conservative rule for a simple example: only establish a timing advantage when the slower candidate’s lower interval bound exceeds the faster candidate’s upper bound. This is not a general statistical significance test. It is a transparent interval-separation rule. With paired trials, an interval for the difference itself would often be more informative (Figure 5).
Fig. 05 / Interactive
Is the difference established?
For an actual benchmark, we should retain repeated observations, document how uncertainty is estimated, and distinguish practically meaningful differences from numerically detectable ones. If configurations are close enough that we can’t reliably distinguish them, the appropriate conclusion may be that we need more evidence or that either is acceptable.
Publishing extra decimal places doesn’t resolve the problem.
What does a megabyte cost?
Eventually we have to choose. A frontier can identify viable trade-offs, but it doesn’t tell us which one is preferable for our application.
One way to make that decision is to express the costs directly. If a compressed archive will be retained for twelve months, storage cost accumulates over that period. If it is decoded a thousand times, decoding cost accumulates with each retrieval. Encoding may happen just once.
For a simple lifecycle model, define:
Here and are costs per second of encoding and decoding, is the number of retrievals, is retention in months, is storage cost per MB-month, and is the compressed size in MB. Every term is expressed in the same cost unit.
This model deliberately excludes transfer charges, fixed overhead, dictionary costs and many other considerations. We can add them when they matter. The useful property is that we can explain why one configuration wins, rather than treating the weights as universal constants (Figure 6).
Fig. 06 / Interactive
Change the workload. Change the decision.
Illustrative prices: encoding and decoding US$0.0001 per second; storage US$0.00002 per MB-month. Not market quotations.
For a desktop archive browser, the lifecycle model may not be the right objective at all. A user waiting for a preview experiences latency directly. A better measure might be time to first useful content, bytes decoded to access a single entry, or responsiveness under cancellation.
Different applications require different objectives. That’s not a weakness of compression benchmarking. It’s the thing a useful benchmark needs to expose.
Building a reproducible frontier
To investigate these relationships with real codecs, I’d start by defining a fixed corpus and the operations we’re interested in. For each implementation, sweep documented compression levels and supported thread counts. Record complete output bytes, encoding and decoding wall time, memory where comparable, and the result of byte-perfect reconstruction. Record independent trials rather than only final averages.
Keep codec-only and complete archive measurements separate. Pin the versions, builds, input hashes, context reuse rules and timing boundaries. An experiment comparing independent archive entries should not silently mix results from a solid stream with different access guarantees.
Once the data has been collected, the simplest implementation of a frontier is surprisingly small. The following Python example assumes that every selected metric is finite and has already been oriented so lower is better. It preserves exact ties and rejects invalid observations rather than silently ignoring them.
import math
def pareto_frontier(rows, objectives):
if not objectives:
raise ValueError("Select at least one objective")
for row in rows:
if any(not math.isfinite(row[k]) for k in objectives):
raise ValueError("Invalid measurement")
def dominates(a, b):
return (
all(a[k] <= b[k] for k in objectives)
and any(a[k] < b[k] for k in objectives)
)
return [
row for row in rows
if not any(dominates(other, row) for other in rows)
]This direct comparison is quadratic in the number of configurations and is appropriate for small datasets. Larger datasets may justify specialized algorithms. More importantly, the function doesn’t handle uncertainty, feature incompatibility or feasibility constraints. Those should be addressed explicitly before interpreting its output.
The experiment described here is a proposed protocol, not a completed benchmark. The interactive figures use deliberately synthetic values so that the mathematical relationships remain visible without implying performance results for named libraries.
What this means for Peel and Rind
When developing an archive engine, it’s tempting to optimize the measurements that are easiest to publish. Compression ratio and sequential throughput are useful, recognizable numbers. But they don’t necessarily describe the work that dominates an archive browsing experience.
Someone opening an archive may want to enumerate its contents, preview a single document, or extract one directory. The structure of the container, the location of metadata, the availability of indexes and the independence of compressed blocks may matter more than the maximum throughput of the underlying codec.
I’d like an independent benchmark to make those distinctions visible. It should allow another implementation to outperform Rind on the same workload, identify where Rind has a different trade-off, and expose cases where neither implementation meets the actual requirements.
There is no reason to hide those outcomes behind a composite score. A score can be useful as a summary of a declared objective. The frontier and the raw measurements should remain available so that someone with different priorities can reach a different conclusion.
The landscape, not the summit
Think again about the landscape at the beginning of the article. Its peaks represent different kinds of performance, not measured codec results. A higher point in one direction need not be preferable in another. We need to know where we’re trying to go before we decide which position is best.
Compression engineering is full of choices like this. Smaller files may cost more computation. Independent blocks may sacrifice compression ratio in exchange for access and resilience. A larger dictionary may improve one workload while making another infeasible.
None of that means we cannot make rigorous comparisons. Quite the opposite. It means we need to be precise about what our comparisons establish.
There may be a best configuration for a particular workload, hardware environment, set of constraints and stated objective. There is no reason to expect that configuration to remain best when those conditions change.
The interesting engineering work isn’t finding the name at the top of a leaderboard. It’s understanding the landscape well enough to make the right choice.
References and further reading
- lzbench — open-source compression benchmarking
- Zstandard — implementation and configuration documentation
- Pareto efficiency — overview and further references
- Kalibera and Jones, Rigorous Benchmarking in Reasonable Time (2013)
Research disclosure: All figure values and cost assumptions are hypothetical. No empirical codec benchmark was executed for this article. The frontier algorithm and lifecycle model are explanatory examples. References are further reading, not a claim of a fresh source-code audit.
