Skip to content

Span-ify your code: write high performance memory aware C#

License

Notifications You must be signed in to change notification settings

MonarchSolutions/spanify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

⚠️ Always benchmark and test the code for correctness, especially when using low-level/unsafe APIs.

8️⃣ APIs marked with this icon are available in .NET 8. The rest are available in .NET 7.

Table of contents

Introduction to APIs and stack allocation

Creating and manipulating strings

Parsing and formatting values, by way of writing JsonConverters

Writing to buffers and streams

Optimize access to collections

Writing to the Console using UTF-8

About

Span-ify your code: write high performance memory aware C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%