Open AaronO opened 2 years ago
FYI this also fixes a "bug" in decode_engine
where we over alloc the buffer's size:
let mut buffer = Vec::<u8>::with_capacity(input.as_ref().len() * 4 / 3);
This approximately allocates with a ratio of 4/3 instead of 3/4 (without accounting for padding, etc...)
Thanks for this work. However, I'm not sure who the target user would be -- if you're ok with unsafe, the forthcoming AVX2 version will surely outperform it, and if you're not, you'd probably want the existing safe version. 🤔 Good catch on the over-allocation, too!
Hi. There is another crate base64-simd for performance. It is highly unsafe but much faster than base64
crate.
I have some in progress work to address https://github.com/marshallpierce/rust-base64/issues/182, after which https://github.com/marshallpierce/rust-base64/pull/170 will be addressed.
Avoid calloc overhead of initializing buffer we'll write into, improving
decode_small_input/decode/3
by -33%Unfortunately requires unsafe Vec::set_len so we can get a mutable ref to the uninit portion of the Vec's buffer
Before
After