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?

Collection Performance: Using ForEachAsync() with List<>

The post demonstrates the usage of Parallel.ForEachAsync() with a List of reference types.

Collection Performance: Comparing Byte Array’s with SequenceEqual()

LINQ's SequenceEqual() method compares two Byte arrays, returning a Boolean indicating equal length and matching elements. Access more on collection performance by subscribing.

Speed up LINQ Any() with Spargine FastAny()

The article introduces FastAny(), a method in the DotNetTips.Spargine.Extensions NuGet package designed to accelerate LINQ's Any() call, showcasing a 1.08 times performance improvement over the standard method. Notably, FastAny() not only enhances speed but also includes a built-in null check for the collection.

Collection Performance: Comparing ImmutableArray<>’s with SequenceEqual()

The ImmutableArrayExtensions contain a SequenceEqual() method for comparing ImmutableArray items. The method compares elements using the default equality comparer for TSource and can be used with a for() loop for performance validation.

Collection Performance: Iterating Through Reference Value, and Record Types

The author delves into the performance disparities of using reference types, value types, and record types in collections.

Collection Expressions in .NET 8

Beginning with .NET 8, you have the option to employ the novel collection expression to generate frequently used collection values. A collection expression comprises a concise syntax, which, upon evaluation, can be assigned to a wide array of collection types. Key Features of Collection Expressions: Concise Syntax: Easily create collections using square brackets [] and comma-separated elements, such as … Continue reading Collection Expressions in .NET 8

Collection Performance: Memory Efficiency with AsMemory() in Byte Array Conversion

The article discusses the efficiency benefits of using AsMemory() for byte array conversion, emphasizing reduced memory usage, future-proofing code, and performance optimization. Benchmark results highlight a significant performance advantage, with a 54 times improvement compared to other methods, reinforcing the importance of AsMemory() for optimal performance in memory-sensitive applications.

Collection Performance: Converting Byte Array to Memory<> and ReadOnlyMemory<>

When working with byte arrays, there are two methods to convert to Memory. Using AsMemory() offers performance optimization, efficient memory management, improved code clarity, and future-proofing. Benchmark results show a 57x performance improvement, with no memory allocation. This method is crucial for memory-sensitive applications and large datasets. Utilize AsMemory() for optimal performance and efficient array handling.

Collection Performance: Exploring the Performance Impacts of Array Properties

The post critiques developers’ practices of using properties that return arrays, highlighting issues like lack of encapsulation, read-only enforcement challenges, and limited flexibility for future changes. It recommends using methods or collections as alternatives, despite performance benchmarks indicating that array properties are more efficient, ultimately suggesting adherence to Microsoft's guidelines.