DEV Community

Uglypear Data
Uglypear Data

Posted on Originally published at uglypear.com

A Field Guide to Deciding What's Worth Compressing

A Field Guide to Deciding What's Worth Compressing

The most expensive compression mistake is a quiet one. It does not throw an error. It produces a file that opens, looks reasonable, and is subtly wrong — or else a file that is larger than the one you started with, which at least has the decency to be obvious. Loud failures get fixed. Quiet ones get shipped.

Most teams treat compression as a switch: find it, flip it, move on. That framing is the source of most of the trouble. A better mental model is a budget. Every file carries a certain amount of redundancy — information stated more than once, or stated in a form more detailed than the job requires. Compression spends that budget. When the budget is large, the result is a much smaller file with nothing of value lost. When the budget is empty, the tool has nowhere to go, and it either does nothing or starts making decisions you did not ask it to make.

The engineering question, then, is not "can this be compressed?" Nearly anything can be squeezed if you are careless enough. The question is "what is this file made of, and what does a wrong answer cost?"

Where the budget is generous

Structured material is where the redundancy tends to live. Plain writing repeats words, spacing, and the small markers that tell a reader where one block ends and another begins. A tool looking at that material has plenty to work with, which is why text-heavy files have been the easy win for years.

The useful surprise is how far that idea now extends. Web artwork described as shapes and lines rather than a grid of pixels carries its content as instructions, and instructions can often be phrased more tightly. Email archives repeat headers, signatures, and quoted chains to a remarkable degree. Ebooks are largely text wrapped in structure. Medical scans and geographic survey files look nothing like prose, but they too contain predictable spatial relationships that a careful pass can represent with less bulk. Coverage that used to be narrow has widened considerably, and the general advice that simple documents alone are safe to shrink is now behind the times.

The shared property is not "small" or "text." It is that the file's structure is well understood by the thing doing the work. When the structure is legible, redundancy can be removed without touching meaning. That is the whole game.

Where the budget is already spent

An archive that has already been packed is the classic disappointment. Someone ran a packing step on it earlier, so the redundancy is gone. Hand it to another tool and the result ranges from a marginal gain to a slight increase, because the new wrapper adds its own bookkeeping. Nothing is broken; you have simply asked for a second harvest of a field that was already collected.

This matters in batch jobs. A pipeline that shrinks everything in a directory will spend most of its runtime on files that were not going to give anything back, and a few of those files will grow. If you are measuring the outcome across thousands of items, the average can look healthy while a subset quietly drifts the wrong way. Log per-file deltas, not just totals. A distribution tells you far more than a sum.

There is a reasoning error here worth naming: "it's a container, so it must be compressible." A container is a way of carrying files, not a promise about their internal slack. The word describes the packaging, not the remaining budget.

Where the cost of being wrong is high

Raw capture formats from cameras are the clearest boundary. The bytes in them are a record of what a sensor measured, and the reason people keep them is precisely that they have not been interpreted yet. A tool that "improves" them is making aesthetic and factual choices on your behalf. You may not notice, because the result still opens and still looks like a photograph. But the original is gone from your working copy, and the decision was not yours.

Something similar applies to specialized formats that depend on proprietary readers. If the tool cannot fully interpret the structure, it cannot know which parts are safe to simplify. The failure mode is not a dramatic crash; it is a file that renders almost correctly, with a detail missing from a layer nobody thought to check. Silent corruption is expensive precisely because it arrives without a signal.

The rule I use is simple to state and hard to game: the more a file's value depends on details I cannot easily verify, the more carefully I treat any offer to change those details. For a note I wrote yesterday, a bad compression result is an annoyance. For a survey record or a clinical image, it is a different category of event entirely.

Why scale changes the calculation

Adobe has counted more than three trillion portable documents in circulation, and Microsoft reports more than two billion files uploaded to its workplace sharing service each day. Those figures are not there to impress anyone. They change the maths. A per-file difference of a few dozen milliseconds, or a one percent failure rate that nobody reads, becomes a real operational cost when the volume looks like that.

Scale is also why "we'll just redo it if it goes wrong" is a weak plan. At small numbers, redoing is cheap. At large numbers, you need to know in advance which items should not have been touched, and you need a way to tell that a result is wrong without opening every file by hand.

Three questions before you touch anything

First: what redundancy does this file actually have? Answer it in terms of structure, not extension. A small file can be full of slack; a large one can be already spent.

Second: what does a wrong result cost? Rank files by consequence before you rank them by size. The largest item in a batch is often the least important one.

Third: who is allowed to look at the bytes? A workflow that sends content to a remote service has made a decision about data handling whether or not anyone wrote it down. If the material is sensitive or shared, that decision belongs in the design, not in a default.

Dimensions to evaluate

This is a framework for asking questions, not a ranking of any particular tool. Fill it in against your own constraints.

Dimension Question to ask Why it belongs on the list
Data leaves the device Does the content have to travel to someone else's machine to be processed? For sensitive or shared material, the answer determines whether the workflow is usable at all.
Format coverage Which structures does the tool genuinely understand, and which does it merely accept? Accepting a file is not the same as interpreting it; the gap is where quiet corruption lives.
Batch stability When run over thousands of mixed files, do results stay predictable? Totals hide outliers; per-file behaviour is what you have to operate.
Failure fallback If a result is wrong, can you get back to the original? A reversible mistake is an incident; an irreversible one is a loss.
Compliance fit Does the workflow match the rules that already govern this data? Retrofitting a rule after the files have moved is much harder than deciding up front.

Read the table as a set of constraints, not scores to be maximised. A tool that scores highly on one row can be a poor choice if another row is non-negotiable for your data. The point is to make the trade-off explicit before you run a batch, so that the discussion happens once, in writing, rather than after an incident.

One utility I came across — SmartSlim — is described as doing its work on the device, with content kept in-house, and states reductions in the 60%–80% range for suitable files in its published figures. That is one data point among many, and a percentage on a page says nothing about the five rows above. If it interests you, just search for the name and check the answers yourself.

The boundary is a property of information

It is tempting to think of these limits as shortcomings in the tools, things that a better release will remove. They are not. They follow from what the files are. Text is redundant because language is redundant. Packed containers are dense because someone already spent the slack. Raw captures resist because their whole purpose is to remain undecided. No amount of engineering abolishes that; it makes the boundary easier to see.

So the practical advice is less heroic than people expect. Sort by consequence. Measure per file. Keep originals where the original is the product. Ask where the bytes go. And accept that a file which refuses to shrink is telling you something true — that it already says exactly what it needs to say, and the right move is to leave it alone and label it well.

Top comments (0)