The post discusses alternative approaches to adding items to a collection using For() or ForEach() from the Task Parallel Library.
Category: C#
General Performance Tip: Can Pattern Matching Improve Performance?
The article discusses the potential performance improvements gained by leveraging pattern matching in .NET. It contrasts a traditional method for rounding numbers with a more refined version employing pattern matching.
Code It Any Way You Want: Checking Strings for Null
The article discusses best practices for checking strings for null in coding. It outlines three common methods: using == null, is null, or string.IsNullOrEmpty().
Reference Type & Structure Performance: Hashing Classes, Records, and Structures
A SHA256 hash can be generated for a class, record, or structure using a specific code. This article shows the differences.
General Performance: Cloning Reference, Value, and Record Types
Microsoft suggests cloning objects via JSON serialization and deserialization. Performance tests show that cloning record types is the fastest method, outpacing reference types by 1.087Ă— and value types by 1.26Ă—. While differences are modest, these results are significant for object cloning efficiency.
String Performance: Optimizing String Substring Extraction – Slicing vs. AsSpan()
The content presents an alternative approach to obtaining a substring using slicing with ReadOnlySpan and AsSpan() methods.
General Performance: Optimizing Method Returns
Modern best practices in method design emphasize returning empty collections instead of null values when no items are found, enhancing code safety and clarity.
Collection Performance: Comparing Key Search Methods in Dictionaries
The post discusses two methods for searching a specific key in a Dictionary. The ContainsKey() method is recommended by Microsoft for improved performance but is it more performant?
Boosting Performance and Memory Efficiency: Introducing ToDelimitedString() with Source Generators in Spargine
The article introduces a method called ToDelimitedString() in programming, using a StringBuilder and commas to create a delimited string. Benchmark results indicate that this method is 1.23 times more performant and allocates less memory, thanks to the utilization of a source generator in Spargine.
Optimizing String Processing in Collections: The Impact of PerformAction() in Spargine and FastStringBuilder
This article explores the optimization of string processing in collections through the integration of the PerformAction() method in Spargine and FastStringBuilder. Demonstrating a 1.79-fold performance increase and reduced memory allocation, the method proves to be a valuable tool for developers seeking enhanced efficiency in string manipulation.

You must be logged in to post a comment.