Skip to content

Performance

Senior performance is measurement-led. BenchmarkDotNet for microbenchmarks, async pitfalls (sync-over-async, ConfigureAwait, threadpool starvation), proper parallelism for CPU-bound work, allocation hunting, string/buffer perf, and the profiler toolbox.

Topics (canonical order)

  • :material-stopwatch:{ .lg .middle }   BenchmarkDotNet


    How it actually measures, pitfalls (cold JIT, GC pressure, branch prediction), [MemoryDiagnoser], baselines

  •   Async Performance Pitfalls


    Sync-over-async, ConfigureAwait, Task.Run misuse, threadpool starvation diagnosis

  •   Parallelism & Data-Parallel


    Parallel.ForEachAsync, PLINQ, partitioners — for CPU-bound work, NOT async I/O

  •   Allocation Hunting


    [MemoryDiagnoser], ETW, dotMemory, common allocation sources

  •   String & Buffer Perf


    StringBuilder, interpolation handlers, SearchValues, Utf8Formatter, string.Create

  •   Profiling Tools


    dotnet-trace to PerfView, sampling vs ETW, identifying hotspots

Why this order

Without BenchmarkDotNet you're guessing, so it leads. Async pitfalls follow because async perf bugs are the #1 production-incident category for .NET seniors. Parallelism comes next because it's frequently confused with async. Allocations and string/buffer perf are the next tier (most apps live here). Profiling tools close the section as the "now what" when a benchmark or a customer reports something.

Cross-references