Why Exceptions should be Exceptional
Explains why exceptions in .NET should be rare, comparing them to asteroid strikes, and analyzes their performance costs versus error codes.
Matt Warren is a software developer and writer focused on deep technical analysis of the .NET runtime, C# internals, performance, and low-level runtime behavior.
76 articles from this blog
Explains why exceptions in .NET should be rare, comparing them to asteroid strikes, and analyzes their performance costs versus error codes.
Explores why reflection in .NET is slow, examining CLR design goals, internal data structures, and the multi-step invocation process.
Explores academic research papers referenced in the .NET runtime and compiler source code, focusing on data structures and optimization algorithms.
Analyzes community and Microsoft contributions to open source .NET repositories over two years, showing trends in issues and pull requests.
Explains the 'fixed' keyword in C#, covering its role in unsafe code, how the compiler, JIT, CLR, and GC collaborate, and its use for pinning objects in memory.
Explains how to extend the .NET Core CLI by creating custom commands (verbs) that integrate with the current project context.
Analyzes performance inefficiencies in LINQ queries, including hidden allocations, and offers optimization techniques for C# developers.
Explores the potential memory savings of storing strings in a more compact encoding like ASCII/Latin-1 within the .NET CLR, using real-world data from Stack Overflow.
Explores the System.Runtime.CompilerServices.Unsafe API in .NET for low-level, high-performance pointer manipulation while bypassing standard type safety.
A guide to analyzing .NET memory dumps using the CLR MD library, covering heap inspection and string analysis.
A technical analysis of performance optimizations in the .NET Wire serialiser library, using BenchmarkDotNet to measure the impact of each change.
Explains how to use the .NET TryStartNoGCRegion API to prevent garbage collection pauses during critical code execution.
Explains how the .NET Garbage Collector pauses threads at safe points to perform collection, detailing the suspension mechanism and TTSP.
Explains how the .NET Core CLI tooling executes code, detailing the transition from traditional .NET runtime to the new dotnet command-line process.
A deep dive into visualizing and understanding the .NET Garbage Collector's behavior using a custom tool and ETW events.
Explores the unique memory layout and performance optimizations of the String type within the .NET Common Language Runtime (CLR).
Explores benchmarking tools and techniques using a Stack Overflow code example, focusing on performance optimization and avoiding allocations.
An introduction to Causal Profiling with Coz, a technique that identifies which code optimizations will have the biggest impact on overall program performance.
Explores how BenchmarkDotNet reveals JIT method inlining differences between x86 and x64 .NET runtimes, impacting performance.
A deep dive into using BenchmarkDotNet to analyze memory allocations and performance differences between string concatenation and StringBuilder in C#.