rust-base64 icon indicating copy to clipboard operation
rust-base64 copied to clipboard

SIMD support?

Open JosiahParry opened this issue 6 months ago • 2 comments

I'm curious what would need to be done to include SIMD support here. I ran a quick comparison between bindings to base64 here and the python bindings of the libbase64 which has SIMD support and the difference particularly for encoding are quite stark!

Using rust-base64 I can encode a 200mb file in 0.43 sec but with pybase64 (the bindings) it happens in 0.08 secs which is, I believe, due to the SIMD support on Mac M1. Decoding was 0.16 and 0.14 sec respectively.

I suspect that use of simd should be fairly straightforward here because we're dealing with know chunk sized of 4 bits at a time e.g. u8x64 https://rust-lang.github.io/portable-simd/core_simd/simd/type.u8x64.html could be quite handy here.

JosiahParry avatar Jan 13 '24 16:01 JosiahParry