Performance Archives - Code Maze https://code-maze.com/category/performance/ Learn. Code. Succeed. Mon, 09 Sep 2024 06:03:52 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.5 https://code-maze.com/wp-content/uploads/2020/01/Code-Maze-Favicon.png Performance Archives - Code Maze https://code-maze.com/category/performance/ 32 32 SIMD Accelerated Numeric Types in C# https://code-maze.com/csharp-simd-accelerated-numeric-types/ https://code-maze.com/csharp-simd-accelerated-numeric-types/#respond Mon, 09 Sep 2024 05:00:34 +0000 https://code-maze.com/?p=123337 In this article, let’s explore the various SIMD (Single Instruction, Multiple Data) accelerated numeric types in .NET. We’ll start by examining what SIMD stands for and how it works in .NET. Then, we’ll look at the different SIMD accelerated numeric types available in .NET. To conclude, we’ll implement a benchmark to compare the performance of […]

The post SIMD Accelerated Numeric Types in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-simd-accelerated-numeric-types/feed/ 0
Fastest Way to Get a Dictionary Key by Value in C# https://code-maze.com/csharp-fastest-way-to-get-a-dictionary-key-by-value/ https://code-maze.com/csharp-fastest-way-to-get-a-dictionary-key-by-value/#respond Mon, 06 May 2024 05:39:53 +0000 https://code-maze.com/?p=116632 The C# language does not provide a built-in method that we can use to retrieve a key from our dictionary using its value. However, using other features of the language, we can create methods to perform this task. In this article, let’s implement and discuss several methods that we can utilize to get a dictionary […]

The post Fastest Way to Get a Dictionary Key by Value in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-fastest-way-to-get-a-dictionary-key-by-value/feed/ 0
Baseline Styling in BenchmarkDotNet https://code-maze.com/csharp-baseline-styling-in-benchmarkdotnet/ https://code-maze.com/csharp-baseline-styling-in-benchmarkdotnet/#respond Thu, 18 Apr 2024 05:38:38 +0000 https://code-maze.com/?p=116307 In this article, we will learn how to set a baseline for our benchmark in BenchmarkDotNet and discuss styling the baseline results. As software developers, benchmarking the performance of our methods is a crucial part of our day-to-day activities. With the BenchmarkDotNet library, we can accurately perform this operation. When we use this library for […]

The post Baseline Styling in BenchmarkDotNet appeared first on Code Maze.

]]>
https://code-maze.com/csharp-baseline-styling-in-benchmarkdotnet/feed/ 0
Fastest Way to Find and Extract a Number From a String in C# https://code-maze.com/csharp-fastest-way-to-find-and-extract-a-number-from-a-string/ https://code-maze.com/csharp-fastest-way-to-find-and-extract-a-number-from-a-string/#respond Sun, 14 Apr 2024 21:36:49 +0000 https://code-maze.com/?p=116252 This article will explore the quickest method to find and extract a number from a string in C#. We will discuss and implement different techniques for accomplishing this task. Subsequently, we will evaluate the performance of these techniques using the BenchmarkDotNet library. Let’s dive in. Find and Extract a Number From a String Using Regular […]

The post Fastest Way to Find and Extract a Number From a String in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-fastest-way-to-find-and-extract-a-number-from-a-string/feed/ 0
Improve Performance With Source-Generated RegEx in .NET https://code-maze.com/csharp-improve-performance-with-source-generated-regex/ https://code-maze.com/csharp-improve-performance-with-source-generated-regex/#respond Thu, 04 Apr 2024 03:02:08 +0000 https://code-maze.com/?p=114934 In this article, we’ll look at source-generated RegEx and how it can improve performance in our .NET applications. Let’s dive in! How Does RegEx Work? Regular expressions are vital to the programming world, but do we know how they work in .NET? Let’s examine the example: public static class PasswordValidator { public static bool ValidatePasswordWithRegularRegEx(string […]

The post Improve Performance With Source-Generated RegEx in .NET appeared first on Code Maze.

]]>
https://code-maze.com/csharp-improve-performance-with-source-generated-regex/feed/ 0
The Fastest Way to Remove the Last Character of a String https://code-maze.com/csharp-fastest-way-to-remove-the-last-character-of-a-string/ https://code-maze.com/csharp-fastest-way-to-remove-the-last-character-of-a-string/#respond Sat, 30 Mar 2024 08:56:24 +0000 https://drafts.code-maze.com/?p=113414 Creating and manipulating string objects can be useful when building applications. In the C# programming language, string objects contain text values stored as a sequential read-only collection of character objects. This means string objects are immutable and thus can’t be changed once created. Despite this, we often find ourselves needing to manipulate them. In this […]

The post The Fastest Way to Remove the Last Character of a String appeared first on Code Maze.

]]>
https://code-maze.com/csharp-fastest-way-to-remove-the-last-character-of-a-string/feed/ 0
Fastest Way to Check if a List is in Order in C# https://code-maze.com/csharp-fastest-way-to-check-if-a-list-is-in-order/ https://code-maze.com/csharp-fastest-way-to-check-if-a-list-is-in-order/#respond Fri, 29 Mar 2024 07:38:35 +0000 https://code-maze.com/?p=110068 In this article, we’ll examine different techniques to check whether or not a list is in order in C#. We’ll begin by examining several techniques, including parallel processing. Finally, we’ll run a series of benchmarks to help us choose which option fits best in our use case.  So, let’s begin! Initial Setup Before we start […]

The post Fastest Way to Check if a List is in Order in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-fastest-way-to-check-if-a-list-is-in-order/feed/ 0
What’s the Best Way to Count the Digits in a Number https://code-maze.com/csharp-whats-the-best-way-to-count-the-number-of-digits-in-a-number/ https://code-maze.com/csharp-whats-the-best-way-to-count-the-number-of-digits-in-a-number/#respond Tue, 26 Mar 2024 06:34:49 +0000 https://code-maze.com/?p=110029 In this article, we examine how to count the digits in a number, using C#. Finding the number of digits of an integer is a common problem in informatics. For instance, it’s useful when we need to convert numbers from one numerical system to another, or when we want to understand the order of magnitude […]

The post What’s the Best Way to Count the Digits in a Number appeared first on Code Maze.

]]>
https://code-maze.com/csharp-whats-the-best-way-to-count-the-number-of-digits-in-a-number/feed/ 0
How to Benchmark a Method’s Performance Across Different .NET Versions https://code-maze.com/csharp-benchmark-methods-performance-across-different-net-versions/ https://code-maze.com/csharp-benchmark-methods-performance-across-different-net-versions/#respond Fri, 22 Mar 2024 07:42:04 +0000 https://code-maze.com/?p=109982 As .NET developers, we often benchmark the performance of our methods using a single .NET version. However, we can also benchmark a method’s performance across different .NET versions. Such benchmarks can come in handy when we want to upgrade our codebase to a newer version. In such scenarios, we can use the benchmarks to identify […]

The post How to Benchmark a Method’s Performance Across Different .NET Versions appeared first on Code Maze.

]]>
https://code-maze.com/csharp-benchmark-methods-performance-across-different-net-versions/feed/ 0
Using Memory For Efficient Memory Management in C# https://code-maze.com/csharp-using-memory/ https://code-maze.com/csharp-using-memory/#respond Wed, 20 Mar 2024 06:17:04 +0000 https://code-maze.com/?p=109970 Effective memory management is a crucial aspect of programming languages, especially when performance and efficiency are paramount. In C#, developers have access to a powerful API, Memory<T>, enabling them to work flexibly and efficiently with memory. In this article, we will delve deep into Memory<T>, exploring its features, advantages, ownership models, and practical usage scenarios.  […]

The post Using Memory<T> For Efficient Memory Management in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-using-memory/feed/ 0