Commit babf7ad
committed
perf: optimize SIMD loops with unsafe indexing
Replace slice-based access (base[i:i+lanes]) with unsafeIndexVec to eliminate
runtime.panicBounds checks in critical SIMD loops.
Changes:
- Replace unsafeSliceInt8/16/32/64 and unsafeSliceUint* with unsafeIndexVec
- Add unsafeIndexBase and unsafeIndexOffset for optimal performance
- Update Sum*, Mean*, Min*, Max*, Contains*, Clamp* functions
- Remove unused unsafeSlice* helper functions
Generated code size: ~96 bytes / ~12 instructions less per function
Better cache locality without slice header overhead1 parent 14fff24 commit babf7ad
5 files changed
Lines changed: 186 additions & 489 deletions
0 commit comments