Performance: Code It Any Way You Want!

The post emphasizes that debates over coding styles in .NET often overlook the negligible performance differences they create. It affirms that readability, maintainability, and team standards are more crucial than minor optimizations, as modern .NET frameworks efficiently handle performance. Developers should focus on clean code rather than getting bogged down by insignificant details.

dotNetDave Rocks The GLUGnet User Group

The dotNetDave For Those About To Code: Worldwide Tour will be at the GLUGnet User Group in Okemos, MI on August 19th at 6 PM EDT. I hope you will join me at this meeting. This meeting will be virtual, but I wish it was in person. My session will be followed by a Q&A where you can ask me anything!

Not “Super” Code with Over 7,000 Violations

I have been analyzing code for issues for a very long time. In this article, I will share what I found at a recent contract I was working on. I have analyzed some bad solutions in my career, and this is hands down one of the worse I have done in recent memory. I will show you just some of the over 7K violations. The biggest issue with this solution, which is in production, is the very poor architecture it has. Honestly, I do not know if there was any architecture for these 7 projects.

dotNetDave Rocks The Tech Valley .NET User Group

The dotNetDave For Those About To Code: Worldwide Tour will be at the Tech Valley .NET User Group (TVUG) in Latham, NY on August 10, 2021.

Serializing Objects: JSON Serialization

The article explores the significance of object serialization into JSON format, comparing Newtonsoft.Json and JsonSerializer in .NET.

Collection Performance Under Load: for() and foreach()

Let’s discuss for() and foreach() under load to establish a baseline. As you can see below, I used the same code in the previous chapter and added Task.Delay() to simulate a CPU load.

String Performance: String Comparison

The article discusses the importance of choosing the right string comparison method in coding, emphasizing the use of ToUpperInvariant() for accurate globalized comparisons, and presents benchmark results showing its performance advantage. It also briefly mentions the comparison between the == operator and Equals() for checking string equality. Updated January 2024.

Collection Performance: Looping Over a Collection

There are four main ways to loop through a collection by using for(), foreach(), do() and while(). Let’s see which one of these methods are the most performant along with using the generic ForEach() method. Updated September 2023.

Reference Type & Structure Performance: Best Practices

General best practices for types. Updated January 2023.

Reference Type & Structure Performance: Disposable Types

The article emphasizes the critical importance of addressing IDisposable issues in code assessments, highlighting common problems such as virtual memory leaks, unreleased file handles, and escalated database connections. The author provides solutions to two prevalent issues: neglecting to call Dispose() on disposable types and failing to implement the IDisposable interface. Additionally, the author introduces three extension methods from their open-source assembly, Spargine, designed to simplify the disposal of types and mitigate potential memory issues in large collections.