Turbocharged: Writing High-Performance C# and .NET Code
summary
Demos and microbenchmarks show concrete wins: using Span<T> slicing cuts a return-copy to sub-nanoseconds, changing string building to span-based writes yields ~26% faster and ~74% fewer bytes allocated, and reworking CSV/S3 processing with pipelines and sequence readers drops ~97% of memory allocations (example: 18M messages/day → ~10GB fewer allocations). Tools used include BenchmarkDotNet, Visual Studio profilers and JetBrains tracing; patterns shown are ArrayPool.Rent/Return and low-level JSON via Utf8JsonReader for near-zero-allocation parsing.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 5:03Performance in .NET
- 10:22Benchmarking tools
- 15:58Optimizing with Span<T>
- 29:20Span<T> optimization example
- 37:02ArrayPool<T> for allocations
- 40:54Streaming with System.IO.Pipelines
- 44:12File processing optimization
- 50:48High-performance JSON
- 58:52JSON improvements benchmark
- 1:01:16Summary
related talks
46mHigh Performance .NET
47mUnlocking Performance Improvements in .NET
01h 02mApplication Performance Optimisation in Practice
01h 06mGet Better App Performance with this One Weird Trick
37mRock Your Code Code and App Performance for Microsoft .Net
42mMeasure Twice, Optimize Once: Real-World .NET Profiling with Visual Studio
01h 03mApplication Performance Optimisation in Practice
01h 02mPerformance tricks I learned from contributing to the Azure .NET SDK
