Tags: xtaci/qpp
Tags
perf: optimize EncryptWithPRNG/DecryptWithPRNG for ~32% throughput im… …provement Performance improvement from ~1450 MB/s to ~1920 MB/s while maintaining full backward compatibility. Optimizations applied: - Inline xoshiro256ss PRNG to eliminate function call overhead - 2x loop unrolling (process 16 bytes per iteration instead of 8) - Bounds check elimination hints using `_ = d[15]` - Use bit shift `count << 3` instead of multiplication `count * 8` - Pre-compute XOR offsets for better instruction-level parallelism - Add //go:nosplit compiler directive to avoid stack split checks - Early return for empty data slices - Optimize struct field ordering for better cache locality - Add padding to Rand struct for optimal alignment Benchmark results (AMD Ryzen 9 5950X): Before: ~1450 MB/s After: ~1920 MB/s
PreviousNext