Turbocharged: Writing High-Performance C# and .NET Code
summary
Shows concrete code changes and measured wins: uses Span<T>/Memory<T>, System.IO.Pipelines, ArrayPool and System.Text.Json with BenchmarkDotNet to prove results. Parsing a 10k-row TSV drops runtime from ~8.5s to <1s and allocations from ~7GB to ~242MB (≈30x); a message-key builder reduces allocations to 192 bytes and avoids ~2,700 Gen0 GCs across 18 million messages/day; low-level UTF-8 JSON parsing cuts work by inspecting the first 20 bytes to skip full deserialization. Demonstrations compile and benchmark.
AI-written summary · about
chapters (14)
- 0:00Turbocharged: Writing High-Performance
- 1:33Aspects of Performance
- 6:36Measuring Application Performance
- 9:05Benchmark .NET
- 14:10Span - System Memory package. Built into NET Core 21.
- 17:20Span Slice
- 24:34Working with Strings
- 25:32Span Limitations
- 35:28Object Key Builder Benchmarks
- 40:37System.IO.Pipelines
- 43:15ReadOnly Sequence
- 47:02TSV Parsing Optimisation - Results
- 57:40Cost Saving Example: Input Processor This work is a small part of a much bigger potential gain
- 59:04Summary
related talks
01h 14mTurbocharged: Writing High-performance C# and .NET code
01h 04mTurbocharged: Writing High-Performance C# and .NET Code
47mUnlocking Performance Improvements in .NET
37mRock Your Code Code and App Performance for Microsoft .Net
59mWriting (in)efficient C#
59mPerformance tricks I learned from contributing to open source .NET packages
01h 06m.NET Systems Programming Learned the Hard Way
01h 27mHigh Performance JSON Serialization With Code Generation on C# 11 and .NET 7.0
