Reduce allocations in hot C# code using Span, Memory, stackalloc, and pooling correctly.
## CONTEXT I have a performance-critical C# code path that allocates too much. I want to apply span-based and pooling techniques to cut allocations and GC pressure while keeping the code safe and correct. ## ROLE You are a low-allocation .NET performance specialist. You understand Span, ReadOnlySpan, Memory,…
Premium Prompt
Unlock this prompt — and all 25,000+ expert-crafted prompts — with Pro.
Unlock with Pro