Code & App Performance

This page is for all the articles I have published about code performance for Microsoft .NET. Some of this content is free and some are for subscribers to


General Performance Tips for Microsoft .NET

Reference Type & Structure Performance

These articles discuss ways to speed up performance for your reference types and structures (also known as user-defined types). Both can have different behavior since reference types are created on the memory heap, which is controlled by the .NET Garbage Collector and structures are created on the memory stack that can be a lot more performant.

Override Object Virtual Methods

String Performance

Strings are widely used in programming, especially when processing user input. These articles will go over the best way to format strings, perform string comparisons, check for an empty string, and more.

Internationalization and Localization

Collection Performance

Collections are one of the most widely used types in .NET since most of the data coming from a data source can have 1 to N results. In this series of articles, I will discuss looping over collections, the most performant way to retrieve collections from a method, and more. Make sure to do your own benchmarking for these examples when using your own custom types. . In the next series of articles, we will tackle the performance of collections under simulated loads.

Collection Performance Under Load

These articles will focus on looping through a collection with a simulated load such as retrieving data from a database or a web service. If parallel processing needs to be added to your project, make sure you benchmark with your own code before deciding on an approach to speed up processing. Try to test on machines that are as near as possible to production servers, including memory and hardware. What might be more performant on your development machines will be very different on a production server.

For more information on processing collections in parallel, go to the Parallel Loops documentation on the site.

Serializing objects

Serialization is something very important to think about for good model class design. These articles discuss how to serialize objects to JavaScript Object Notation(JSON) and Extensible Markup Language (XML) to achieve the best performance.

Analyzing Code For Issues

How do you find performance issues in your code? Many of these rules have been ingrained in my brain over the years I have been coding in .NET, but I still need to use tools to speed up this process or to find the ones I miss. Using tools that I describe in this chapter will dramatically decrease the time it takes to find issues, so you can get back to adding features so you can get more customers!

I am recommending these tools since they are the ones that I have used for many years and are part of my workflow before I check in code.