With the arrival of Go 1.27, an experimental SIMD package has been introduced.
I found this Zig library (https://github.com/zigcc/zig-msgpack) for MessagePack that uses SIMD, along with other Assembly optimizations, and according to their benchmarks the improvement of performance is between 10% and 90%.
Here is a list of features they added, according to the README:
Optimization Features
CPU Cache Prefetching
Platform-specific prefetch instructions (x86: PREFETCH*, ARM: PRFM)
Intelligently prefetches data before it's needed for containers ≥256 bytes
Multi-level cache hints (L1/L2/L3) for optimal cache utilization
Streaming prefetch for non-temporal data access
SIMD Operations
Automatic detection of available SIMD features (AVX-512, AVX2, SSE2, NEON)
Vectorized string comparison (16-64 byte chunks)
Vectorized memory copying with alignment optimization
Vectorized byte order conversion (big-endian ↔ little-endian)
Batch integer array conversions (u32/u64)
Memory Alignment Optimization
Automatic alignment detection and fast path selection
Aligned memory reads/writes for supported types
Memory alignment preprocessing for better SIMD performance
Large data copy optimization (≥64 bytes)
Branch Prediction Optimization
Hot path annotations for common cases
Lookup tables for O(1) marker byte conversion (256-entry precomputed table)
Switch expressions instead of if-else chains (jump table optimization)
Optimized error handling paths
HashMap-Based Maps
O(1) average-case key lookups (vs O(n) linear search)
Efficient hash function with depth limiting
Support for any Payload type as keys
getOrPut optimization (single hash computation)
Maybe should someone explore the possibility to add them to this Go library too?
With the arrival of Go 1.27, an experimental SIMD package has been introduced.
I found this Zig library (https://github.com/zigcc/zig-msgpack) for MessagePack that uses SIMD, along with other Assembly optimizations, and according to their benchmarks the improvement of performance is between 10% and 90%.
Here is a list of features they added, according to the README:
Maybe should someone explore the possibility to add them to this Go library too?