Stackalloc and Spans

Stackalloc and Spans

13.899 Lượt nghe
Stackalloc and Spans
Allocating memory on the heap can slow a program down by creating work for the .NET garbage collector. In C# we can improve performance by using the stack instead. Source code available at: https://github.com/JasperKent/Spans-and-stackalloc Topics include: - Referencing contiguous memory with Span and ReadOnlySpan - Allocating on the stack with stackalloc - Writing high performance methods with zero heap allocation - Avoiding the need for unsafe code - Fast text parsing