Hacker News new | ask | show | jobs
by lifthrasiir 2423 days ago
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

1 comments

You can do better, without SIMD: https://github.com/powturbo/TurboBase64

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