Day 1/30 — SearchValues in .NET 8/9 (.NET & C#)
Found this gem while tracing Gen0 GC pressure on our text parsing hot path.
• Static caching: SearchValues instances must be static readonly fields to avoid recreation overhead.
• SIMD vectors: JIT compiler auto-vectorizes operations against CPU registers for massive throughput gains.
• Zero allocations: Span-based signatures eliminate managed heap overhead entirely during execution.
Watch out: Creating SearchValues inside a tight loop negates performance gains due to initialization costs.
Are you still using IndexOfAny for parsing?

Top comments (0)