4 ms·
Figured as much. Interested to see the results. My assumption is that it doesn't change much. However, I suppose that depends on the compression algorithm.
by leetbulb 8y ago
Figured as much. Interested to see the results. My assumption is that it doesn't change much. However, I suppose that depends on the compression algorithm.
- BeeOnRope 8y agoIn principle a good byte-wise entropy coder should recover nearly 100% of the base-64 "inflation" since no entropy is added. In practice gzip doesn't get all of it since it is an imperfect entropy coder for several reasons.
- hermitdev 8y agoYou are correct, but gzip is a generally happy medium of cost to encode/decode and encoded size when transmitting over a fast network. For a 10 Mbps or greater link, if you use something like bzip2 or 7z, you'll likely spend more time encoding than transmitting a payload. This is from my personal experience utilizing gzip and bzip2 via Boost Iostreams to compress network payloads over a 1Gbps link. End to end latency was far superior with gzip than bzip2, despite bzip2 having a smaller transmission size.
- BeeOnRope 8y agogzip is only a happy medium if your other candidates are 7z (LZMA) or bzip2, which are both stronger but slower compressors. bzip2 is essentially obsolete (off the pareto frontier), and LZMA is good but slow so will only be best if your transmission speed is low. Near the space/time tradeoff point that gzip lives, however, it is thoroughly outclassed by more modern compressors such as zstd or brotli with the appropriate settings.
- tedunangst 8y agoFrom personal experimentation, a gzipped base64 jpeg is close to the same size as the jpeg. So if you want to efficiently store some emails, it doesn't really matter whether you decode and store attachments separately or just compress the raw text. (Although decoding and separating allows deduping.)