smoltext vs Storing Raw: Compression Cost Tradeoffs Explained
When compressing small payloads with smoltext beats storing them raw, and when it doesn't.
The Question Behind the Question
It's tempting to assume compression always saves money. It doesn't always — compression has costs too. This explainer weighs smoltext against simply storing or transmitting small payloads raw, so you can decide on real numbers rather than instinct.
What Storing Raw Costs
Raw storage and transfer are simple: no compute, no extra dependency, no decompression step. The cost is purely the bytes — storage volume and bandwidth. For small, infrequent payloads, those bytes may be cheap enough that nothing else is worth doing.
What smoltext Costs
smoltext reduces the bytes, but adds an API call to compress and another to decompress, each with its own latency and operational dependency. The savings on bytes have to exceed those added costs for the trade to be net positive. On large volumes of small payloads this is often easy; on small volumes it may not pay off.
When Compression Clearly Wins
If you're storing or moving a high volume of small structured payloads, the cumulative byte savings add up fast, and smoltext's per-call overhead is amortized across enormous traffic. This is exactly the niche it's built for — many small messages where raw bytes are a real line item.
When Raw Clearly Wins
If your payloads are rare, or already compressed transparently by your storage layer or CDN, or large enough that a general compressor handles them fine, storing raw (or using existing gzip) avoids adding a dependency for marginal gain. Don't introduce an API hop to save bytes you weren't really paying for.
The Latency Dimension
For data on a hot read path, decompression latency may matter more than storage savings. For cold archival data read rarely, latency is irrelevant and byte savings dominate. Where the data sits in your access pattern changes the answer entirely.
How to Actually Decide
Take a representative slice of your real payloads. Compute storage and bandwidth cost raw, then with smoltext including its call overhead and latency. Compare total cost, not just byte count. The docs at https://doc.sprapp.com show how to script this so the decision rests on your data.
Bottom Line
smoltext beats raw when you have high volume of small structured payloads where byte savings exceed the API overhead. Raw beats smoltext for rare, large, or already-compressed data. Measure the full cost — compute, latency, dependency — not just the compression ratio.