Performance
4 posts tagged “Performance”.
August 2026
-
Parse text without allocating with Span<T>
Splitting a line with
string.Splitcreates a new string for every field. For large files,ReadOnlySpan<char>lets you parse the same data with almost no allocations. -
MongoDB indexes from C#, and how to know you need one
A query that's fast with a thousand documents can scan millions in production. Here's how to create indexes from the C# driver, order their fields, and check that queries actually use them.
March 2026
-
Faster JSON with System.Text.Json source generation
By default, System.Text.Json uses reflection to work out how to serialize your types. A source generator can do that work at compile time instead, for faster startup and trimming support.
December 2025
-
ValueTask: when to use it and when not to
ValueTask<T>can save an allocation on hot paths. It also comes with rules thatTaskdoesn't have, and breaking them causes bugs that are hard to trace.