.NET has introduced low(er)-level memory management APIs over the years that can dramatically reduce the number of allocations and improve performance, and first among them is Span<T>
.
This repo demonstrates common usage patterns for some of those APIs.
8️⃣ APIs marked with this icon are available in .NET 8. The rest are available in .NET 7.
Introduction to APIs and stack allocation
Creating and manipulating strings
Parsing and formatting values, by way of writing JsonConverter
s
Writing to buffers and streams
Optimize access to collections
Writing to the Console
using UTF-8