Concurrency, Performance, Arrays and when Dirty Writes are OK

added by pepethecow
4/25/2012 4:41:42 PM

4 Kicks, 266 Views

This article will show how to increase the performance of a rather simple algorithm up to 80%, by showing how we can accept a loss in absolutely accuracy, and also taking advantage of how processors work.


2 comments

dpeterson
4/26/2012 8:49:40 AM
That's really cool. Are there any JIT or CLR related improvements that can be done to help with the speed? What is the speed comparison to C or when using unsafe/unmanaged code from C# I wonder?

pepethecow
4/26/2012 9:31:18 AM
JIT is one-time thing, once that cost is paid, you don't have to worry about it (you'll see in the sample driver program with the article that I run every algorithm once before timing them to make sure everything is JITted).

The only things I can think of with the CLR would also be one-time costs. Some APIs cache things underneath, but I don't think that applies to any of this simple code. Not sure about comparing to C and/or unmanaged/unsafe code--if you need unmanaged code, you need it, so let's make it the best it can be! :)

Anecdotally, I've found that .Net can be just as performant (at the levels I care about) as unmanaged--but you do have to care about different things.