Awesome
Span
-ify your code
.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.
[!IMPORTANT] Always benchmark and test the code for correctness, especially when using low-level/unsafe APIs.
Table of contents
Basics
Introduction to APIs and stack allocation
Strings
Creating and manipulating strings
Parsing and formatting
Parsing and formatting values, by way of writing JsonConverter
s
Buffers
Writing to buffers and streams
Collections
Optimize access to collections
Console
Writing to the Console
using UTF-8