.NET Performance in 2020

It seems like a good time to conduct a census of performance topics in .NET for the new decade.

The subject is too big to cover in any detail, so this article or more of a map/index to the various aspects.

Dimensions of Performance

Dimensions:

  • Architecture: Scale Out, Distributed Systems
  • Algorythms: Same functionality, different implementation details, eg. BubbleSort -> QuickSort -> Bitonic
  • Memory Efficienty: GC, zero-alloc, stack-alloc, MemoryPool
  • Concurrency: async-await, ThreadPool, locks
  • Intrinsics: SIMD
  • GPU: Paralism by design
  • Branch Prediction (avoiding pipeline flushing)

Techniques:

  • Micro Benchmarking
  • Application Profiling
  • Logging
  • Load Testing

Key people:

Obviously, there are thousands of devs who specialise in perf, and this is only a small list whom I follow.

More Depth...

ASP.NET team re-wrote ASP.NET Core, and made it fast. See technpower benchmarks.

Microsoft rewrote dotnet framework (dotnetcore), and made it fast, along the way. Merging with mono (kinda), see dotnet5

  • Span / ReadOnlySpan / MemorySpan
  • Instrinsics
  • Pipelines
  • async await and IAsyncEnumerable
  • CoreRT, MonoLLVM
  • Benchmark.NET
  • Profiling tools
  • Non-allocating code, GC and struct, stack_alloc
  • @ben_adams and the ASP.NET Core benchmarks

dotnetos's questionaire

The performance-oriented .net conference -- dotnetos.org, recently had online questionare. This is a quick summary of some of the areas they target. It can be read as a check-list of performance considerations:

  • WinDbg
  • Performance Monitoring: Dynatrace, New Relic, AppDynamics
  • Tracing: MiniProfiler, Zipkin, Jaeger
  • Static Anlysers: Roslyn Analysers, StyleCop, FxCop
  • Web Tools: Chrome DevTools, YSlow, WebPageTest
  • Load Tests: jMeter, Visual Studio Load Test, LoadComplete
  • Microbenchmarking: BenchmarkDotNet
  • Dotnet: async/await, TaskCompletionSource, IAsyncEnumerable
  • Dotnet: lock, semephore, WaitHandles
  • Dotnet: System.IO.Pipelines, System.IO.Channels
  • Dotnet: volatile, memory barriers, Interlocked.*
  • Dotnet: garbage collection, generations, SOH, LOH
  • Dotnet: weak handles, ConditionalWeakTable, weak event
  • Dotnet: pin, marshalling types, bittable types
  • Dotnet: Span, Memory, ArrayPool, MemoryPool
  • Dotnet: Unsafe, MemoryMarshal, MemoryExtentions
  • Serialisation: JSON.Net, ProtoBuf, Avro
  • Stack: stackalloc, ref, ref struct
  • CPU: SIMD, Intrinsics, Vector, Matric.*
  • Diagnostics: Performance Counters, ETW
  • Caching: Distrubuted Caching
  • Architecture: Messaging, Stream Processing
  • High Level Dataprocessing: TPL Dataflow, Reactive Extentions .NET