The excerpt from "Rock Your Code" emphasizes the importance of efficient string concatenation in .NET. It highlights the advantages of using the Span type over traditional methods, demonstrating that replacing Substring with AsSpan and leveraging the Concat function significantly enhances performance by 43 times while minimizing memory allocations.
Category: Performance
Rock Your Code: Code & App Performance for Microsoft .NET (5th Edition)
The fifth edition of David McCarter's book, "Röck Yöur Cöde: Code & App Performance for Microsoft .NET," is now available on Amazon. It offers practical techniques for enhancing .NET application performance, including coding patterns, memory insights, and benchmarking. This definitive guide is essential for modern .NET developers aiming for speed and scalability.
Supercharging Application Performance with Intelligent Client-Side Caching
This excerpt discusses enhancing Microsoft .NET application performance by minimizing network calls. The author emphasizes client-side caching with Spargine’s InMemoryCache, which drastically improves responsiveness and scalability for costly operations like reflection. While significant speed gains are noted, developers are advised to benchmark changes, as caching may not always be beneficial.
Code It Anyway You Want: Initializing Reference Type Static Fields Inline for Enhanced Code Readability
Microsoft advises initializing reference type static fields inline to enhance code readability and prevent issues from uninitialized fields. Two patterns are shown: inline initialization and using a static constructor. While both methods do not allocate memory, using a static constructor may slightly improve performance. EditorConfig can check for adherence to this guideline.
Immutable Collection Add() Trap: Don’t Get Burned — Use a Builder Instead
When using immutable collections in .NET, remember that the Add() method creates a new instance rather than mutating the original. Ignoring the return value leads to ineffective loops. Instead, use a builder for efficiency, as it offers faster performance and lower memory allocation while still ensuring immutability in the final result.
dotNetDave Rocks Austin .NET User Group November 2025 Meeting
The dotNetDave No Rest for the Wicked World Tour will visit Austin on November 20, 2025, where I will present a session titled "Röck Yoür Cöde." This session addresses critical issues in memory management related to disposable types in .NET, offering practical techniques to enhance application performance and prevent slowdowns and leaks.
Optimizing Array Performance in .NET: Getting the Most from ArrayPool
ArrayPool optimizes memory usage by providing a thread-safe pool of reusable arrays, significantly reducing allocations and garbage collection pressure, especially in high-performance scenarios. It's effective for I/O, serialization, and media processing. Best practices include tight scope management, clearing sensitive data on return, and careful tracking of logical array lengths.
Boost Your .NET Projects: Efficient Byte Array Conversions
When working with byte arrays in performance-critical applications, every nanosecond and allocation counts. Fortunately, in .NET, there is a class that provides several high-performance methods that can significantly improve speed and reduce memory overhead when converting and manipulating arrays.
Boost Your .NET Projects: Find the Fastest Way to Get an Item’s Index in Arrays
This article examines the performance of three index-finding methods in .NET arrays: Array.BinarySearch (O(log n)), Array.FindIndex (O(n)), and Array.IndexOf (O(n)).
Coding Faster with dotNetTips.com Spargine 8: August 2025 Release
I am delighted to announce the release of Spargine 8 (v2025.8.8.6) on August 6th, 2025. Spargine, my open-source project, now offers NuGet packages for .NET 8 & 9. These enhancements have been integrated across all my projects, many of which are currently in production. I encourage you to explore these updates and share any feedback … Continue reading Coding Faster with dotNetTips.com Spargine 8: August 2025 Release

You must be logged in to post a comment.