Improving std::simd::swizzle_dyn
Summary
The article analyzes std::simd::swizzle_dyn in Rust, detailing the limitations of current 128-bit-focused implementations across NEON/AVX, and introduces a portable optimization approach for larger widths. It discusses a four-shuffle decomposition that halves work across vector halves to achieve significant speedups (notably 4x on AVX2 for 512-bit vectors), the interplay with LLVM and build-time vs runtime selection, and benchmarks comparing scalar, AVX2, and base64 workloads. Practical takeaways cover LLVM inefficiencies, cross-repo development for portable-simd, and the upcoming syncing of optimizations into std::simd and fearless_simd.