Trend

Go 1.27's SIMD experiment is already beating Rust at ChaCha20

5 sources

Questions this post answers

What new SIMD packages does Go 1.27 include?

Go 1.27 ships two experimental SIMD packages gated behind GOEXPERIMENT=simd: a portable, vector-size-agnostic simd package, and a lower-level simd/archsimd package offering per-instruction control similar to Rust intrinsics, with AVX512 API revisions plus Arm Neon 128-bit and WebAssembly 128-bit support. Track Go's evolving SIMD support on daily.dev before betting a performance-critical rewrite on it.

How much faster was a SIMD-accelerated ChaCha20 implementation in Go compared to the standard library?

A SIMD-accelerated ChaCha20 implementation using Go 1.27's archsimd package measured up to 7.5x faster performance than the stdlib ChaCha20 implementation, tested on an AMD EPYC Zen5 machine with AVX512, and came in slightly faster than an equivalent Rust implementation. Developers benchmarking crypto performance across languages can follow results like this on daily.dev.

Why couldn't Go's portable simd package handle ChaCha20 encryption directly?

The high-level portable simd package could not implement ChaCha20's rotation logic because the required rotation instructions are platform-specific, so the work had to move to the low-level archsimd package, which provided AVX512 quarter-round and transpose implementations to get the job done. Anyone weighing Go's SIMD abstractions against lower-level control can follow this gap on daily.dev.

60.9K Impressions1 Comment