Performance, tooling and publishing
This part of the C# course makes every claim about speed a measurement. Stopwatch and five runs with a median come first, then a struct against a class on the same data, boxing, Span in a hot loop and three ways to join strings, each with the numbers this machine printed. Debug against Release, tiered compilation and debugging without an IDE follow, then dotnet format, the analyzers of the SDK, and trimming, ReadyToRun and NativeAOT.
9.1
Measuring with Stopwatch
a warm-up run, five runs, min and median, the machine line
Open
9.2
struct against class, measured
the same data in both shapes, the numbers
Open
9.3
Boxing and unboxing
object, GetType, the allocation, GC.GetAllocatedBytesForCurrentThread
Open
9.4
Span in a hot loop
ReadOnlySpan<char> in a parsing loop, measured
Open
9.5
String concatenation, measured
+ against StringBuilder against string.Join
Open
9.6
Debug against Release
the same loop in both configurations, measured
Open
9.7
Tiered compilation and ReadyToRun
DOTNET_TieredPGO, a ReadyToRun build if it builds here
Open
9.8
Debugging without an IDE
Debug.WriteLine, Debugger, DOTNET_ variables, a stack trace, what is not installed
Open
9.9
dotnet format
--verify-no-changes, what it fixed, the exit status
Open
9.10
Roslyn analyzers in the SDK
AnalysisMode, EnableNETAnalyzers, -warnaserror, one analyzer that fires
Open
9.11
Trimming and NativeAOT
trimming warnings, the real AOT error of this image
Open