Nov 13 2009

.NET vs .NET (a quick performance test)

Category: .NET | Frameworks | Visual StudioJonathan @ 06:51

Since we can target our code to a specific compiler and target the platform of our choice, I thought it would be fun to see what sort of differences in speed, it would bring up.

I did two tests. First I looped through integer values, the columns on the left and then object assignments for the column on the right. For the object assignment, I created a simple class with a string property, created the class and set the property in the loop. Interestingly there were some differences.

The object assignment is obviously a large percentage of what we do in an object oriented world. Visual Studio 2010 was a lot slower than 2008 all round, but did perform decently for .NET 4.0. However small this simple test is it shows quicker times from 2008, and it shows that 2010 suddenly improves when using .NET 4.0. It took around 25 seconds longer to create the objects targeting the .NET Framework 3.5 using VS 2010, than VS 2008.

The test was done in Debug mode, Vista 64.

integer loop
2.0 2008 3.0 2008 3.5 2008
2.7735668 2.7634976 2.7670054
2.7659806 2.7567702 2.771937
2.7700194 2.7612681 2.7782053
2.7697211 2.7606385 2.7811199
2.7750242 2.7747622 2.7802291
13.8543121 13.8169366 13.8784967
2.0 2010 3.0 2010 3.5 2010 4.0 2010
2.7465096 2.7569809 2.7655086 2.734276
2.7577021 2.7531411 2.7583006 2.753255
2.7505392 2.7429336 2.7568989 2.753271
2.741854 2.7503117 2.7655838 2.761961
2.740013 2.7474619 2.7784012 2.759656
13.7366179 13.7508292 13.8246931 13.76242


object creation, string property assignment
2.0 2008 3.0 2008 3.5 2008
15.9305226 15.38386 15.8581671
15.2397368 14.59608 14.7847291
15.1368118 14.7387 14.6265273
14.7425454 15.42782 14.5719368
14.7806622 15.25851 14.9774767
75.8302788 75.40496 74.818837
2.0 2010 3.0 2010 3.5 2010 4.0 2010
20.3244424 20.76454 20.7134072 18.37988
20.2770724 20.61586 20.8497297 18.04806
21.2592798 20.74874 20.856723 18.32123
20.5916017 20.64923 20.897214 18.62922
20.3946783 20.61862 20.7991 18.42922
102.8470746 103.397 104.116174 91.80762

Tags: , ,