Advanced
C#
Q91 / 100
What is the .NET Runtime Performance Improvement approach with Spans?
Correct! Well done.
Incorrect.
The correct answer is B) Span<T> and stackalloc enable processing data without heap allocations, eliminating GC pressure in tight loops
B
Correct Answer
Span<T> and stackalloc enable processing data without heap allocations, eliminating GC pressure in tight loops
Explanation
int[] result = new int[n] on hot paths allocates GC-tracked memory. stackalloc + Span<int> puts the array on the stack — zero GC impact for small, scoped buffers.
Progress
91/100