Ask HN: Should we still Base64 encode?
Base64-encoding incurs some overhead (storage and computation). For context, Base64-encoding is a mechanism to encode bytes (0-255) to a radix-64 alphabet (0-63), with '=' for padding. Base64 encoding is 4:3 output:input, so 33% overhead.
Assumption: Many systems (modulo email) are 8-bit clean nowadays.
As an example, many session tokens are base64 encoded, but if we know that these tokens will only interact with 8-bit clean systems, should we not avoid the overhead?
8 comments
[ 3.4 ms ] story [ 24.6 ms ] threadYour assumption is flawed. Most of the 'systems' that were not 8-bit clean (and resulted in the various 'encodings' being required) remain just as 'not 8-bit clean' today as they were then.
I haven't read the HTTP/2 RFC's but with any luck they are 8-bit clean, which would be progress.
For medium-large messages I would tend to use JSON/msgpack where appropriate, so no need to further encode anything.
For small (binary) messages, other encodings (e.g. ascii85) often wasn't much smaller and didn't encode faster, so there was no measurable performance benefit. And given the extra complexity and compatibility issues it would take to use something else, it just wasn't worth it.