yolow64 is a Rust Base64 codec with zero runtime dependencies and runtime-dispatched SIMD kernels. Yesterday's 0.3.1 took the AVX2 kernels about as far as they go: 21 GB/s with every byte validated. Version 0.4.0, released today, adds the tier that was missing — hand-scheduled AVX-512 assembly — and turns the codec into a five-tier design that picks the best kernel for whatever CPU it lands on. This is the complete form of the library.
The problem: one binary, three generations of CPU
A data pipeline ships one build. The fleet underneath it is not one machine: a Zen 5 node here, an older Skylake-SP there, an AVX2-only box in the corner. Compile for the newest tier and the old nodes can't run it; compile for the baseline and the new silicon idles. AVX2 processes 32 bytes per instruction — AVX-512 doubles that to 64 and adds exactly the byte-manipulation instructions Base64 has always wanted. On an AVX-512 machine, an AVX2-only codec is leaving a 3–5× speedup unclaimed.
So 0.4.0 dispatches at runtime across five tiers — Scalar < AVX2 < AVX512BW < AVX512VBMI < AVX512VBMI2 — stored in a single relaxed atomic, with a thread-local cap so every tier can be forced and tested on any machine.
The VBMI tier: the instructions Base64 wanted
- Decode by 128-entry lookup.
vpermt2bindexes across two 64-byte tables at once, translating a full 64-byte block in one instruction class; errors accumulate withvpternlogdlogic ops instead of extra passes. Full validation stays on — the 0.3.1 rule (validate everything) holds at this tier too. - Encode by multi-shift.
vpmultishiftqbextracts the 6-bit fields directly, replacing the shift-and-mask chains AVX2 needs. - Whitespace without branches. The VBMI2 tier filters whitespace with
vpcompressb— matching bytes are compressed out with no data-dependent branching. - Masked tails and streaming paths. Short fixed-length encoders/decoders (8–128 B, 12–172 chars), masked tails instead of scalar cleanup loops, non-temporal stores with a 64 B-aligned peel, and
prefetchwon large destinations.
The BW tier: AVX-512 for the machines that came first
Skylake-SP has AVX-512 but no VBMI. The BW tier gives it 512-bit encode/decode/validate anyway — with one deliberate boundary: it engages from 512 B upward, and shorter inputs stay on AVX2, because heavy 512-bit instructions on that generation trigger frequency licensing (the core clocks down). Using the wide path only where it wins is the honest engineering call. Measured on Skylake-SP: 1.27–1.95× over AVX2 from 4 KiB.
The numbers (AMD Zen 5)
- Encode: 164.6 GB/s at 8 KiB — base64-turbo 145.1, simdutf 110.5
- Decode: 101.4 GB/s at 16 KiB — base64-turbo 91.4, simdutf 62.2
- Same core vs yolow64's own AVX2: 2.79–4.95× encode, 3.07–3.80× decode
- First place in all 9 short encode and all 9 short decode sizes on this tier
The AVX2 tier kept moving too: 12-byte decode is down to 4.4 ns, and mid-size encode reaches 23.69 GB/s at 8 KiB. And all x86-64 assembly now flows through a single macro emitting ELF, COFF, and Mach-O — the same kernels build on Linux, Windows, and macOS. About 3,000 lines of experiments and dead encoders were deleted along the way.
Two bugs this release fixed in itself
Worth naming, as usual. First, a dispatch bug: AVX2 power-of-two tail kernels could bypass the AVX-512 BW tier entirely for decode_to_vec, append_decode, and decode_streaming — on a Skylake-SP machine those APIs silently never got the wide path. Second, decode_short_slow reported an interior = as InvalidByte { byte: 61 } instead of InvalidPadding. Both are fixed, and the test suite now runs all five tiers against the scalar reference through the public API, plus exhaustive 0–255 short inputs and a 96 KiB guard-page test.
One honest gap: Intel Ice Lake and Sapphire Rapids are not yet measured — the 48 KiB prefetchw threshold was tuned on Zen 5. The numbers above are Zen 5 and Skylake-SP hardware, stated as such.
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.4" # features = ["parallel"] for the multi-threaded paths The API is unchanged from 0.3.x — the tier selection is automatic. Use yolow64 when Base64 is on a hot path, especially on AVX-512 hardware where an AVX2-only codec leaves multiples on the table, or on mixed fleets where one binary has to be right everywhere. If your workload is a config string twice a day, you still don't need any of this.
- GitHub: https://github.com/YOLOW92/yolow64
- crates.io: https://crates.io/crates/yolow64
- Changelog: https://github.com/YOLOW92/yolow64/blob/main/CHANGELOG.md

