3 ms·
Encoding to base64 increases the size by at least 33%. This is to help make links small enough to share on places like twitter, dischord etc where the max lengt
by KilledByAPixel 7y ago
Encoding to base64 increases the size by at least 33%. This is to help make links small enough to share on places like twitter, dischord etc where the max length is around 4000 bytes.
- stock_toaster 7y agoIf you compress the json first, it isn't quite so bad. Example #1 (short string): input: 103 bytes gzip(input): 87 bytes base64(gzip(input)): 117 bytes Example #2 (long string): input: 3122 bytes gzip(input): 840 bytes base64(gzip(input)): 1121 bytes
- KilledByAPixel 7y agoThanks, that is good reference. It makes sense that Zip would beat out JSON for longer strings. Just as another point of comparison, how about encodeURIComponent(gzip(input))?
- zaarn 7y agoThis project also blows up the size and it seems by much more than 33% on average. You'd safe some space by using base64.