yolow64 is a Rust Base64 codec with zero runtime dependencies and runtime-dispatched SIMD kernels. Version 0.3.1, released today, rewrites the AVX2 kernels. The headline is not just speed — it is speed at 100% validation, in a field where the fast numbers usually come from checking less.
The problem: validation is the tax nobody wants to pay
Most high-throughput Base64 benchmarks quietly make a trade. Validation — confirming every input byte is in the alphabet, the padding is canonical, the trailing bits are zero — costs instructions, so fast paths sample it, make it optional, or skip it. If your input is untrusted, you then pay for a separate validation pass, or you accept malformed data downstream.
Real-world Base64 makes it worse. A large share of it arrives wrapped: PEM blocks, MIME attachments, certificates — lines of 76 characters separated by CRLF. The usual fast path pre-strips the whitespace in a separate pass over the data before decoding even starts. Two passes, one of them pure overhead.
Concretely: an ingestion job decoding wrapped, untrusted Base64 all day — mail archives, certificate bundles, data-URL payloads — pays both taxes at once. That is the workload 0.3.1 was built against.
Decode: one less shuffle, validation in one instruction
The old bulk kernel used five vpshufb shuffles per 32-byte block. The shuffle unit (Port 5 on Intel) is the bottleneck of every AVX2 Base64 decoder, so the rewrite is organized around feeding it less:
- Validation via De Morgan. Instead of range-check ladders, the kernel computes
bad = (~V) & Hwith a singlevpandn— one instruction validates all 256 possible byte values across the block. - The
'/'fold. The Standard alphabet's awkward value ('/'maps to 63, out of the 0–62 range the shuffle tables want) is fixed with a saturating unsigned clamp,vpminub(raw, 63)— one cycle on the vector ALU ports instead of another shuffle. - Error accumulation moves off Port 5. Errors are accumulated with saturating adds (
vpaddusb) on Ports 0/1 rather thanvpor, keeping the shuffle port free for translation.
Net: 4 shuffles and 12 vector ALU ops per block, a 4.0-cycle theoretical floor. Measured: 21.13–21.69 GB/s from 8 KiB to 1 MiB with every block and every trailing padding bit validated — 5.3–8.5% faster than 0.3.0, and from 256 KiB upward it passes Turbo-Base64's default configuration, which spot-checks 25% of blocks. Full validation beating sampled validation is the result this release exists for.
Wrapped input: the whitespace pass is gone
CRLF-tolerant decoding was rewritten around a nibble-automaton whitespace classifier (one shuffle classifies bytes by high/low nibble) plus fused packing of two MIME-76 lines into five vector blocks. No pre-strip pass; the whitespace is absorbed inside the decode loop. CRLF decode improves 68–81% — 15.5 GB/s at 1 MiB — and ranks first at every CRLF size in the eight-library benchmark.
Encode, short inputs, and streaming
- Encode kernels got the same assembly treatment, with load/store grouping scheduled to avoid Intel's false 4K-aliasing stalls and non-temporal streaming stores: peak 23.45 GB/s.
- Fixed-length short kernels (including a straight-line 172-character decoder) hold first place at all nine short sizes in both directions — an 8-byte decode is 4.82 ns.
- New
Codec::decode_streamingfor one-shot cold buffers, using non-temporal stores from 4 KiB up; the streaming APIs measure 1.45–1.62× on cold data. - Four-thread parallel decode/encode at 4 MiB: 37.2–39.6 GB/s decode, 38.6–40.7 GB/s encode.
A correctness fix worth naming
The parallel decoder had a real bug: an interior chunk ending in = padding could be accepted at a worker boundary. Interior chunks now force padding: false and verify exact output lengths, so invalid interior padding is rejected with Error::InvalidPadding, as it should be. The release also adds a Linux guard-page test proving the kernels make no out-of-bounds reads or writes, and malformed MIME/PEM edge tests. A release about speed that also closes a validation hole is the honest shape of this changelog.
Use it like this
use yolow64::{Codec, Alphabet, STANDARD}; let encoded = STANDARD.encode_to_string(b"hello")?; // "aGVsbG8=" let decoded = STANDARD.decode_to_vec(encoded.as_bytes())?; // b"hello" let url_safe = Codec { alphabet: Alphabet::UrlSafe, padding: false, ignore_whitespace: false }; [dependencies] yolow64 = "0.3" # features = ["parallel"] for the multi-threaded paths Use yolow64 when Base64 is on a hot path and the input is not yours — untrusted payloads, wrapped formats, high volume. If you encode a config string twice a day, every codec is fast enough and this is more engineering than you need.
- GitHub: https://github.com/YOLOW92/yolow64
- crates.io: https://crates.io/crates/yolow64
- Changelog: https://github.com/YOLOW92/yolow64/blob/main/CHANGELOG.md

