8 ms·
The amount of optimizations, specifically around using stack allocated objects, .net has seen in recent years is amazing. Another one beyond all the span stuff
by runevault 2y ago
The amount of optimizations, specifically around using stack allocated objects, .net has seen in recent years is amazing.
Another one beyond all the span stuff (though related) that got added in dotnet 9 was AlternateLookup for stuff like dictionary and HashSet where you create a stack allocated object that lets you use stack related objects to compare.
Simple example, if you have a dictionary you are building and you're parsing a json file, you can use spans and compare those directly into the dictionary without having to allocate new strings until you know it is a distinct value. (Yes I know you can just use the inbuilt json library, this was just he simplest example of the idea I could think of to get the point across).