Weissman: A Real Formula for a Fake Contest
Two compression algorithms. One benchmark. Two different winners. All we did was change the unit of measurement.

Imagine we’re evaluating two compression algorithms. We’ve given them the same file, the same hardware, and the same reference compressor. One produces smaller files. The other finishes faster.
We run the numbers, calculate their Weissman scores, and declare a winner.
Then we convert seconds to milliseconds.
The other algorithm wins.
We haven’t changed the hardware, the software, the input, or the amount of time either algorithm took. We’ve changed how we represent a measurement, and in doing so, we’ve changed the conclusion of the experiment.
That shouldn’t be possible.
From television to computer science
In 2014, HBO’s Silicon Valley introduced audiences to a surprisingly compelling engineering problem: how do you determine whether one compression algorithm is better than another?
The show’s fictional company, Pied Piper, needed a way to demonstrate that its compression technology was superior. Compression ratio alone wouldn’t accomplish that. An algorithm that produces extraordinarily small files but takes hours to process them isn’t necessarily better than one that achieves reasonable compression in seconds.
The show’s creators needed something that represented both.
Stanford professor Tsachy Weissman and graduate student Vinith Misra developed what became known as the Weissman score. It was a real mathematical expression designed for a fictional competition.
The interesting part is what happened next.
Developers implemented calculators. Researchers explored its applicability. It appeared in classrooms and academic discussions. A metric created to make an engineering accomplishment understandable to a television audience began finding applications outside the show.
Its appeal is easy to understand. Compression performance is multidimensional, and a single score makes comparisons considerably easier to communicate.
But reducing several measurements to one number requires making decisions about how those measurements relate to one another. Those decisions deserve scrutiny.
Understanding the score
The Weissman score is conventionally expressed as:
Where:
- is the compression ratio of the algorithm being evaluated.
- is the compression ratio of the reference algorithm.
- is the candidate’s compression time.
- is the reference’s compression time.
- is a scaling constant.
Compression ratio, in this context, is the original size divided by the compressed size. A larger ratio represents a smaller compressed representation.
The first part of the expression is straightforward:
If an algorithm achieves twice the compression ratio of the reference, this term equals two. If it achieves the same ratio, it equals one.
It is dimensionless. Whether the file sizes are measured in bytes, kilobytes, or megabytes makes no difference, provided the measurements are consistent.
The second part is where things get interesting.
Rather than comparing elapsed times directly, the formula compares their logarithms.
It looks reasonable until we ask a fairly basic question.
What units are we measuring time in?
Changing the winner
Consider a reference compressor that takes ten seconds to process a file.
Compressor A achieves the same compression ratio as the reference but finishes in five seconds. Compressor B achieves a compression ratio 20 percent higher than the reference but takes eight seconds.
Both improve upon the reference. A is faster, while B produces smaller files.
Using the Weissman formula with a scaling constant of one, we get the following:
| Compressor | Relative ratio | Compression time | Score in seconds | Score in milliseconds |
|---|---|---|---|---|
| Reference | 1.0× | 10 s | 1.000 | 1.000 |
| A | 1.0× | 5 s | 1.431 | 1.081 |
| B | 1.2× | 8 s | 1.329 | 1.230 |
These are calculated examples, not measured codec benchmarks.
When measured in seconds, A wins.
When measured in milliseconds, B wins (Figure 1).
For Compressor A, the calculations are:
Compressor B experiences the same mathematical transformation, but its higher compression ratio becomes more influential relative to the timing component.
The problem isn’t that the scores themselves change. A different scoring scale could reasonably produce different numerical values.
The problem is that the ranking changes.
If we were selecting a compression algorithm based on this benchmark, our engineering decision could depend entirely on whether the developer implementing the calculator chose seconds or milliseconds.
This isn’t a new discovery
In 2017, IEEE Spectrum published an article examining the Weissman score’s adoption outside Silicon Valley.
Among the researchers interviewed was Dror Baron, then an assistant professor of electrical and computer engineering at North Carolina State University. Baron identified the absence of defined time units as a weakness in the metric and demonstrated how converting the same measurements between seconds, minutes, and hours produced substantially different results.
IEEE Spectrum — Weissman Score Calculators Migrate Online, But Metric Needs Some Improvements
The problem was recognized relatively early in the metric’s existence. What’s worth examining today is what that weakness means for the design of compression benchmarks more generally.
It’s also worth acknowledging that the researchers weren’t necessarily attempting to establish a universal benchmarking standard when they developed the formula. They were solving a specific communication problem for a television show.
The Weissman score accomplished that remarkably well.
Applying it to engineering decisions introduces a different set of requirements.
The mathematics behind the problem
When we convert a time measurement from seconds to milliseconds, we multiply it by 1,000.
More generally, let represent any unit conversion factor.
The timing component becomes:
Using the properties of logarithms, we can expand that into:
The conversion factor doesn’t cancel. It introduces an additional term into both the numerator and denominator, changing their relationship.
As becomes increasingly large, the timing component approaches one.
In practical terms, choosing progressively smaller units of time diminishes the influence of compression speed on the score. Compression ratio eventually becomes the predominant factor.
The unit of measurement has effectively become an undocumented weighting parameter.
There are additional complications.
When the numerical value of the candidate’s compression time equals one, its logarithm equals zero and the expression becomes undefined.
When both time measurements are below one, the score can reward slower compression. When the two measurements fall on opposite sides of one, the timing component can become negative.
This isn’t particularly obscure behavior in modern software. Many compression operations complete in less than a second. Small files, individual archive entries, and in-memory compression workloads routinely operate at those timescales.
We could address some of these practical issues by prescribing a fixed unit and restricting the formula’s domain. That would establish a reproducible convention, but it wouldn’t change the underlying relationship or make the formula unit-invariant.
The implementation is another problem
A mathematically sound scoring formula is only useful if the measurements supplied to it are comparable.
One of the publicly available implementations of the Weissman score is Lorenzo Saino’s Python calculator, available on GitHub. It evaluates a target compression command against gzip and calculates the score using measurements from repeated executions.
The implementation provides an interesting example of how benchmark methodology can introduce additional problems independently of the formula.
Consider the gzip baseline:
with open(fname, 'rb') as f_in:
with gzip.open(
fname_compr, 'wb',
compresslevel=compresslevel
) as f_out:
t_start = time.time()
f_out.writelines(f_in)
T = time.time() - t_startThe timer starts after the input file and gzip output stream have been opened.
More importantly, the timer stops before execution exits the gzip context manager.
That distinction matters because closing a compression stream can involve finalizing compressed data, writing format-specific trailers, and flushing buffered output.
The target algorithm, however, is measured differently. Its timer encompasses a call to an external subprocess:
t_start = time.time()
retcode = subprocess.call(command.split(" "))The elapsed time is recorded after the subprocess returns and its exit status has been checked.
Assuming the target command completes its compression work before exiting, its measured time includes process invocation, initialization, compression, finalization, and process termination.
The gzip baseline doesn’t necessarily include all equivalent operations.
The two paths therefore have different timing boundaries (Figure 2).
Source: weissman.py — gzip_compr_test and target_compr_test
There are other implementation details worth considering. The calculator uses time.time() rather than a monotonic performance clock, defaults the gzip baseline to compression level nine, and evaluates the target’s compressed output size without independently verifying a lossless round trip.
The script does what it sets out to do: calculate a Weissman score against a gzip reference. But treating its results as a comprehensive performance assessment would require additional methodological work.
These are observations from the source code, not measured performance differences. Establishing the magnitude of their effects would require controlled experiments.
The broader lesson is that even if we replace the Weissman formula with something mathematically stronger, unequal measurements can still invalidate the comparison.
What are we actually trying to optimize?
Working on an archive utility introduces a somewhat different perspective on compression performance.
Consider a backup system. It may spend considerable time compressing data that will rarely be retrieved. A higher compression ratio could justify additional computation because the resulting storage savings accumulate over months or years.
Now consider someone browsing a compressed archive on their Mac. They want to preview a document, inspect an image, or search for a particular file. They probably don’t care how long the archive originally took to compress.
They care how quickly they can access its contents.
A software distribution platform might compress an application once and distribute it to thousands of people. A streaming service might need to compress and decompress information within strict latency constraints. An embedded device might have memory restrictions that eliminate otherwise competitive algorithms entirely.
These are all compression problems, but they aren’t the same optimization problem.
The Weissman score considers compression ratio and encoding time. It doesn’t account for decompression performance, memory consumption, energy use, random access, or the cost of retrieving individual pieces of compressed information.
For some applications, that’s sufficient.
For others, the omitted measurements are more important than the ones included.
A benchmark needs to establish what constitutes good performance before it attempts to quantify it.
A dimensionless alternative
We can address the unit-dependence problem by comparing measurements through dimensionless ratios.
One possible approach is a weighted geometric mean:
Where:
- is the compression ratio.
- is compression throughput, measured as original bytes processed per unit of time.
- is decompression throughput, measured as reconstructed bytes produced per unit of time.
- The subscript identifies the corresponding reference measurements.
- , , and are nonnegative weights whose sum equals one.
The reference scores 100. Candidates are evaluated relative to it.
Because each term is a ratio of equivalent quantities, converting bytes to megabytes or seconds to milliseconds doesn’t change the result.
For example:
The formula addresses the original unit-invariance problem. It also allows us to include decompression throughput and potentially other measurable performance characteristics.
But there’s an important limitation.
We’ve introduced weights.
And those weights represent decisions about what matters.
The weights are the opinion
Suppose we’re evaluating compression technology for an application that allows users to browse archived files interactively.
We could establish a hypothetical profile that places greater importance on decompression throughput:
| Measurement | Weight |
|---|---|
| Compression ratio | 30% |
| Compression throughput | 10% |
| Decompression throughput | 60% |
Consider two compressors with the following normalized performance:
| Measurement | Compressor A | Compressor B |
|---|---|---|
| Compression ratio | 1.20× | 1.00× |
| Compression throughput | 1.25× | 1.00× |
| Decompression throughput | 0.80× | 1.80× |
Using the proposed interactive-access profile, A scores approximately 94.5 and B scores approximately 142.3.
B is favored because its decompression throughput is considerably higher.
Now imagine we’re selecting an algorithm for long-term archival storage. We could prioritize compression ratio at 80 percent and assign the remaining 20 percent equally to compression and decompression throughput.
The results become approximately 115.7 for A and 106.1 for B.
The winner changes again.
Except this time, the change has a legitimate explanation.
We’ve changed the optimization objective rather than the unit of measurement (Figure 3).
Fig. 03 / Interactive
Make the priorities visible.
Change what matters, not how it’s measured.
The weight left after compression ratio is split between compression and decompression throughput.
Compressor B leads by 47.8 points under this weighting profile.
These weights aren’t scientifically established universal constants. They’re illustrative engineering preferences. A production benchmark would need to justify them against actual workload requirements, and an archive-browsing profile would ideally include first-byte latency, random-access latency, and partial extraction costs as well.
That’s an important distinction. A composite score doesn’t eliminate subjectivity. It makes the subjectivity explicit and mathematically consistent.
Perhaps we don’t need a single winner
There’s another way to approach compression comparisons without immediately assigning weights: Pareto optimality.
Imagine plotting compression throughput on one axis and compression ratio on another. Each algorithm, or each configuration of an algorithm, occupies a point.
An algorithm is dominated when another achieves at least equivalent performance across all the selected measurements and performs strictly better in at least one.
A compressor that produces larger files and takes longer to compress them offers no advantage on those two dimensions.
But a compressor that produces smaller files at the expense of speed may still be an entirely reasonable choice.
Collectively, the nondominated configurations form a Pareto frontier.
Instead of telling us which algorithm is universally superior, the frontier identifies the available trade-offs.
Modern compression benchmarking projects such as lzbench provide a useful foundation for exploring these relationships.
The concept becomes considerably more interesting when we extend it beyond two or three measurements. Memory consumption, energy efficiency, latency, and partial extraction performance can all participate in the comparison.
There are complications, of course. Measurements contain noise. Different configurations may have incompatible features. A small apparent improvement may not be statistically meaningful.
Nevertheless, a frontier provides something that a single score cannot: a view of the alternatives we sacrifice when choosing a particular optimization.
Building a benchmark we can trust
The more I consider compression benchmarks, the more I think the scoring mechanism should be separate from the system responsible for measuring performance.
A compression engine should compress data.
A benchmark engine should measure that operation under documented conditions.
A scoring engine should interpret those measurements according to a defined objective.
Combining all three makes it unnecessarily difficult to distinguish improvements in the underlying technology from changes in how performance is measured or interpreted.
An independent benchmarking framework could preserve the raw measurements and apply different scoring methods afterward.
We could calculate the historical Weissman score, evaluate a dimensionless composite score, establish Pareto frontiers, and develop application-specific performance profiles from the same observations, provided the necessary measurements were collected.
New scoring methods wouldn’t necessarily require rerunning years of historical benchmarks.
At a minimum, such a framework should establish the following:
- Correctness before performance. A lossless compressor must reconstruct the original data exactly before its performance is considered valid.
- Equivalent timing boundaries. Codec-only performance and complete application execution should be measured and reported separately.
- Complete byte accounting. Headers, dictionaries, indexes, checksums, and other required decoding information belong in the appropriate size measurements.
- Reproducible environments. Hardware, software versions, compilation settings, thread counts, and input datasets should be documented.
- Statistical transparency. Publish repeated observations and their variability, rather than selectively reporting the fastest result.
- Explicit optimization profiles. Document the measurements, weights, constraints, and reference implementations behind every composite score.
- Independent verification. Provide enough information for another developer to reproduce the experiment without depending on the product being evaluated.
These requirements aren’t unique to compression. They’re fundamental properties of credible experimental engineering.
Compression just provides an unusually interesting environment in which to explore them.
Now what?
The Weissman score shouldn’t necessarily disappear.
It has historical significance, it provides an accessible introduction to compression trade-offs, and its popularity has encouraged people to think about performance beyond compressed file size.
But I don’t think its limitations should be carried forward unquestioned.
As we develop compression technology through Rind and build archive experiences through Peel, there’s an opportunity to explore an independent, open-source benchmarking framework that other developers can use to evaluate their own compression engines.
Not a benchmark designed to make Rind win.
A benchmark that allows us to understand where Rind performs well, where it doesn’t, and which engineering decisions would actually improve it.
That distinction matters. A useful benchmark should expose weaknesses in the technology it was originally built to evaluate.
The goal isn’t necessarily to invent another famous score. It’s to establish a foundation from which meaningful scores can be derived, challenged, reproduced, and improved.
A benchmark should preserve its conclusions when units change—and expose the priorities behind its conclusions.
Anything less risks confusing the performance of our software with the behavior of the instrument we’re using to measure it.
References and further reading
- Tekla S. Perry. Weissman Score Calculators Migrate Online, But Metric Needs Some Improvements. IEEE Spectrum, 2017.
- Lorenzo Saino. Weissman Score — open-source calculator.
- Lorenzo Saino. Calculator implementation, weissman.py.
- lzbench — open-source compression benchmarking.
- Python documentation — gzip.
- Python documentation — time and performance clocks.
Research disclosure: Numerical comparisons in this article are calculated examples. Implementation findings are based on static source-code inspection of the Weissman score calculator, version 0.2, with file blob SHA accb5a8c05735c80780a5f44544a86851f5d3a81. No empirical codec performance results are claimed. The proposed composite scoring formula and weighting profiles are illustrative, not established benchmarking standards.
