News for hackers. Stuff that matters.
Re:Base64 encoding and decoding at almost the speed of a mem... by zuck9 on Wednesday November 06, 2019 @01:45AM (#21460278)
Also worth checking out: https://github.com/superhuman/fast64

That is what Superhuman uses for decoding base64 in browser.

Re:Base64 encoding and decoding at almost the speed of a mem... by vardump on Wednesday November 06, 2019 @02:06AM (#21460360)
I don't see how that's relevant, it looks pretty standard approach for base64 decoding. You can find thousands of similar examples.
Re:Base64 encoding and decoding at almost the speed of a mem... by lifthrasiir on Wednesday November 06, 2019 @02:37AM (#21460482)
Not only it is just a standard approach, it even misses a relatively common optimization for base64 decoding: instead of computing `(lut[a] << 6) | lut[b]` etc., one can precompute `lut6[x] = lut[x] << 6` and compute `lut6[a] | lut[b]` to avoid shifting. This optimization is famously used by Nick Galbreath's MODP_B64 decoder, which is used by Chromium [1] and turns out to be the most performant non-SIMD decoder according to Lemire et al. [2]

[1] https://github.com/chromium/chromium/tree/master/third_party...

[2] https://github.com/lemire/fastbase64

Re:Base64 encoding and decoding at almost the speed of a mem... by powturbo on Wednesday November 06, 2019 @03:10AM (#21460596)
You can do better, without SIMD: https://github.com/powturbo/TurboBase64

The simple base64 scalar version is also faster the chromium implementation.