A mortal's guide to making a pig run faster
summary
Starts with a baseline: PDFPig v0.7 parsing an 838‑page PDF takes ~7.6s on .NET Core 3.1 and ~6.5s on .NET 6, then profiling with PerfView and isolating a hot GetPage method with BenchmarkDotNet and SpeedScope reveals heavy time in a transformation matrix using decimals. Replacing decimals with doubles for geometry cuts that hot path from most of the runtime to ~0.6% of its previous cost and drops the overall run to ~4.3s (≈30% faster on .NET 6); tests guard correctness.
AI-written summary · about
chapters (22)
- 0:00Welcome
- 1:34Performance in .NET
- 2:57Performance principles
- 7:31Performance detective work
- 10:40PDF Pig and baseline
- 13:09Manual performance tests
- 18:47PerfView profiling intro
- 21:14Garbage collection stats
- 23:41Disk I/O bottlenecks
- 24:44Threading and blocking
- 27:12CPU-bound operations
- 29:39Benchmark.NET
- 34:37Profiling a benchmark
- 36:25CPU stacks in PerfView
- 38:31Flame graphs with SpeedScope
- 40:15Matrix multiplication investigation
- 41:18Decimal vs double performance
- 44:53Decimal to double conversion
- 47:23Applying code changes
- 48:31Rebaselining after changes
- 50:19Summary
- 52:05Q&A
related talks
37mRock Your Code Code and App Performance for Microsoft .Net
01h 00mPerformance Improvements in .NET 6
01h 04mTurbocharged: Writing High-Performance C# and .NET Code
46mDeep dive into .NET performance and native AOT
54mPragmatic Performance: When to care about perf, and what to do about it
01h 01mTurbocharged: Writing High-Performance C# and .NET Code
47mSolving .NET performance issues
43mPragmatic Performance: When to care about perf, and what to do about it.
