.agents/skills/performance-fixer/references/bcl-patterns/numerics-and-simd.md
Techniques for the compute-heavy managed layer — porting native math, batching with SIMD, and nudging the JIT. Mind all TFMs and always prove bit-exact parity for numeric changes (../measuring.md). See ../decision-framework.md — most of these are HIGH complexity and belong only on a proven hot path.
Vector4/Vector128 SIMD±0/Inf/NaN semantics). Batch paths use
System.Numerics.Vector4 (two points per 128-bit lane) with a Vector128.Shuffle swizzle on
net8+ and a portable Vector4 fallback below.SkiaApi.sk_* P/Invoke for a handful of float ops.Vector128 net7+ (fallback below) · ABI: internal (bodies).static readonly bool UseNativeMath on RuntimeInformation that routes the ported methods back
through the native C API on x86 .NET Framework; the equivalence test then asserts bit-parity on
all platforms (see ../hot-paths/geometry-math.md).AggressiveInlining for tiny wrappers[MethodImpl(MethodImplOptions.AggressiveInlining)] on one-line forwarding wrappers and
nibble/parse helpers (SKColor's parse helpers are annotated).AggressiveOptimization (bypasses tiered PGO).sealed and devirtualizationVector256<T> is emulated on ARM64 NEON and was measured 5.7–6.5× slower in
#4241. Prefer Vector128, gate per-architecture, benchmark on both x64 and ARM64.