The new book is a mix of greatly expanded coverage of old topics, as well as new material throughout. The fundamentals of .NET and how the GC and JIT work have not changed, not even in the face of .NET Core, but there have been many improvements, new APIs, and new ways of doing things that necessitated some updating and coverage of new topics.
It was also a great opportunity to incorporate a lot of the feedback I’ve received on the first edition.
Here’s a visualization of the book’s structure. I wrote the book in Scrivener and marked each section with a label depending on whether it was unchanged (green), modified (yellow), or completely new (purple). Click to expand to full size.
This is a good overview, but it doesn’t really convey what is exactly “new”–the newness is spread throughout the book in many forms. Here are some highlights:
- 50% increase in content overall (from 68K words to over 100K words, or over 200 new pages).
- Fixed all known errata (quite a bit more than on that list, honestly).
- Incorporated feedback from hundreds of readers.
- A new foreword by Vance Morrison, .NET Performance Architect at Microsoft.
- Better-looking graphics.
- Completely new typesetting system to give a more professional look. (You’ll only notice this in print and PDF formats.)
- Automated build process that can produce new revisions of all formats much easier than before, allowing me to publish updates as needed.
- Cut the Windows Phone chapter. (No one will miss this, right?)
- Updated cover.
- List of CLR performance improvements over time.
- Significant increase in examples of using Visual Studio to diagnose CPU usage, heap state, memory allocations, and more, throughout entire book.
- Introduced a new tool for analyzing .NET processes: Microsoft.Diagnostics.Runtime (“CLR MD”). It’s kind of like having programmatic access to a debugger, and it’s very powerful. I have many examples of its usage throughout the book, tied to specific diagnostic scenarios.
- Benchmarking! I include actual benchmark results in many sections. Many code samples use a benchmarking library to show the differences in various approaches.
- More on garbage collection, including advanced configuration options; reworked and more detailed explanations of the GC process including less-known information; discussion of recent libraries to help with pooling; examples of using weak references; object resurrection; stackalloc; more on finalization; more ways to diagnose problems; and much, much more. This was already the biggest chapter, and it got bigger.
- More details about JIT, how to do custom warmup, how to figure out which code is jitted, and many more improvements.
- Greatly expanded coverage of TPL, including the TPL Dataflow library, how to use tasks effectively, avoiding lock convoys, and many other smaller improvements to existing topics.
- More guidance on struct and class design, such as immutability, thread safety, and more. When to use tuples, the new ValueTuple type.
- Ref-returns and locals and when to use.
- Much more content on collections, including effectively taking advantage of initial capacity; sorting; key comparisons; jagged vs. multi-dimensional arrays; analyzing the performance of various collection types; and more.
- Discussion of SIMD commands, including examples and benchmarks.
- A detailed analysis of LINQ and why it’s more expensive than you think.
- More ways to consume and process ETW events.
- A detailed example of building a Roslyn-style Code Analyzer and automatic fixer (FxCop replacement).
- A new appendix with high-level tips for ADO.NET, ASP.NET, and WPF.
- And a lot more…
See the book’s web-site for up-to-date details on where to buy, and other news.