Tag Archives: speed

Compare the performance of simple arithmetic operations in C#

I saw a post the other day that said division was the slowest arithmetic operation so I wrote this example to see exactly how the performance of multiplication, division, addition, and subtraction differ with floating point numbers. When you click … Continue reading

Posted in mathematics, performance | Tagged , , , , , , , , , , , | 1 Comment

Compare the performance of the int, long, and byte data types in C#

The example Compare the performance of the float, double, and decimal data types in C# compares the performance of the float, double, and decimal data types. This example performs a similar test for the int, long, and byte data types. … Continue reading

Posted in performance, variables | Tagged , , , , , , , , , , , | Leave a comment

Compare the performance of the float, double, and decimal data types in C#

A computer’s math coprocessor typically gives the best performance with a particular data type. To see which works best on my system and to learn how big the difference is, I wrote this program to compare the performance of calculations … Continue reading

Posted in performance, variables | Tagged , , , , , , , , , , | 6 Comments

Compare LINQ speeds for different approaches in C#

This example compares LINQ speeds while using LINQ in various ways. To find the minimum and maximum X values in a List<Point>, the example Use LINQ to find a bounding box for a list of PointF in C# defines a … Continue reading

Posted in LINQ, performance | Tagged , , , , , , , | Leave a comment

Compare the speeds of different methods for string concatenation in C#

There are several ways you can perform string concatenation in C#. For example, you can use += to add text to an existing string, you can use string.Concat, and you can use the StringBuilder class. This example compares the performance … Continue reading

Posted in performance, strings | Tagged , , , , , , , , , , , | 1 Comment