As programmers, we concatenate strings all the time. Should we worry about the performance? How about the amount of garbage we’re producing for the garbage collector? Today’s article runs a quick test to find out!
Posts Tagged performance
Last week I covered the performance of cryptographic hash algorithms like MD5 and SHA-1. This week I’ll continue by testing the performance of the closely-related encryption algorithms. This includes algorithms like AES, DES, RC2, Rijndael, and TripleDES. Which is fastest? Does the key size, block size, padding mode, or cipher mode matter? Read on to see!
Sooner or later you’ll need to use a cryptographic hash function. Sometimes it’s to quickly check if two large byte arrays are the same, sometimes it’s for interoperability with some server, and other times it’s to obfuscate a string. In any case, performance of the various hash algorithms varies wildly. Today’s article performance tests all 27 hash algorithm permutations to see which is fastest and which is slowest. Read on for the performance test results!
SafeList) have a great feature for fast lookups:
BinarySearch. However, the list needs to be sorted in order to use it. You could call
Sort() first, but that would give back all the performance you got with
BinarySearch. It’s better to just keep the list sorted all the time. Unfortunately, there is no function on
SafeList to efficiently insert an item into a list that’s already sorted. Today’s article presents an extension function that adds this functionality on to
IList<T> and even the non-generic
IList so your list will always be sorted for quick lookups with
BinarySearch. Read on for the code, unit tests, and a performance test showing the advantages you stand to gain.
C# delegates can be used like function pointers. Assign it once and you don’t have to use an
if over and over. But is the overhead of the delegate worth it? Today’s article puts it to the test to see if this a valid performance boost versus just using an
if over and over. Read on to see if a delegate is worth your time.
foreach loops are really convenient, but are
for loops faster? It’s a simple question, but one that has really wide implications in almost any codebase. Today’s article tests them out to see which is faster for looping over arrays and
Lists. Read on to see which is quicker!
Time class is an easy way to get the relative time. You can find the time since the app started with
Time.time or the time between frames with
Time.deltaTime. But what if you want to know the absolute time? You may need to display a clock to the user, send a timestamp over a network, or record when a game was saved. This is where
System.DateTime comes in. It’s powerful and offers so much functionality that it’s natural to worry about about how slow it’ll be. So today’s article puts it to the test to find out how much time is being spent in operations like
DateTime.Now which gets the current date and time. Is it quick enough that you shouldn’t worry? Read on to find out.
StrangeIoC is a library that can help you build your Unity app with a “pure code” approach. Today’s article addresses one common concern with using StrangeIoC- it uses a lot of reflection. As we know, that’s really slow in Unity. StrangeIoC tries to work around it by letting you control when the reflection takes place so you can put it on a loading screen or some other convenient place. Today’s article finds out just how slow the reflection is to determine if this is really a valid reason to not use StrangeIoC (or other dependency injection frameworks). Read on to find out!