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: , ,

Nov 13 2009

Converting an Enterprise Level App from VS 2008 to 2010

Category: .NET | Frameworks | Visual StudioJonathan @ 02:53


The Wizard opened straight away, I clicked next.
After a few popup dialogs, requesting from me things such as Can't find the source control, remove source control binding? and would you like to upgrade the web projects to .NET 4.0?, which I responded yes to all.

The first problem came when the web project tried to bind to IIS, but failed. the wizard asked if I would like to create the virtual folder, I said yes and it failed, since it already existed. Accepting this to be a fair point, I created a new IIS Application, mapped to my project, edited the project file (right click on the project which failed to load) and selected Edit Project file. The edit context menu is a simply but great new useful feature.

I then reloaded the project from the same context menu and it loaded perfectly.

Running the application worked first time. I ran our manual Sanity Test, our automatic unit tests and all passed first time.

In short, upgrading the web app to .NET 4.0 upgraded and ran perfectly well.
but what would it do if I changed the target platform back to 3.5?

I went directly to the project properties and changed the target platform to 3.5, at which point I was informed that a project reload was required.
I then went through all 16 projects in the solution. Some had changed to 3.5, some were still on 4.0. I changed all projects to 2.5, compiled and ran.

The first Error

I got the following error:
"Could not load file or assembly 'xxx' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Oops, I missed one.
I changed the version to 3.5, rebuilt. Still error.

What happened was all the projects hooked up to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - refused to change to version 2.*. The project reverted back to version 4.0, and I could not keep it in 3.5.
Eventually, after trying tons of manual attempts to reference alternative versions, rebuild etc, nothing worked and I was done.

Start from the top

I decided to start from scratch, get my backup up and start the wizard from scratch, this time, not upgrading to 4.0 from the get-go.

After repeating the exercise and not moving to .NET 4.0, I discovered that all the UnitTestFramework dependent projects had been forced to version 4.0 and I got the same error as before.

You can view the problem on Microsoft Connect, and as I did, discover that not much of a solve has been written there. (Please leave your feedback on the site)

STOP. It is a shame that one would consider the .NET Unit Testing Framework to be such a small piece of the whole 2010 pie, was the reason I cannot upgrade an Enterprise project. Not good for test first is it?

[Let me just point out that Visual Studio .NET 2010 is in Beta 2, at the time of this post]

Tags: , , ,

Nov 6 2009

First Look at VS.NET 2010 (for me)

Category: Visual StudioJonathan @ 02:09

I don't have time for a large introduction to this post, rather I'll jump straight in and tell you about the things that I picked up on.

- The start page, with its now big button, lots of padding approach, seem wasted space, especially on any wide screen monitors. the start page for VS.NET 2008 wasn't anything great, but you had the recent projects, some news and other bits all accessible with one click. A minor thing, but its not a better start page.

- The skinned look. This was a complete waste of time, in my opinion and in fact makes the experience in visual studio worse. With the extra padding, now around all the toolbars (the same width as the splitters), it makes everything seem smaller, and it is. The dragging of the toolbars are much cleaner, smoother than 2008.

I don't like the way the treeview lines and arrows disappear when it has no focus. If it is a setting, I could not find it, but now I cannot at a glance see if a folder has something in it vs one that does. A small point, but means you have to move the mouse and wait for the lines to fade in.

- The code editor now has filtering on what you type in the intelli-sense. Before it simply took you to the correct item in the intelli-sense window, now it removes entries that do not match. This is a massive negative point, as I use the intelli-sense as a browser as well.

- The code editor, firstly which is a major plus, is the selection highlight. Now it is not an inversion of text colour, with blue selection background, it is a translucent colour, which keeps the text colour as it is, untouched. This simple thing is a massive improvement.

- Unfortunately there is a microsecond delay now over 2008 when typing. Each character you type appears that little more slowly, which actually took me a while to get over. It was actually annoying to me. I know I am quite sensitive about it, but I think others will also have picked up on it.

- The skin colour of dark blue with white text on the tabs, now distract me. I always have a black windowed code editor, not the usual white. But now, the toolbar tabs for each file is more visible in my peripheral vision as I type in the editor. This is also distracting.

- The round break point icons in the margin is now that fraction smaller, which I don't like, but can live with.

- Overall, the skin has introduced too much contrast. It is much more stand out as an interface, which is better to look at, but worse to code in.

Why does Visual Basic appear on the root, and c# in 'Other Languages' - on new Project Dialog? Is this a VB editor, then if we are lucky some other languages? I thought .NET was about multi-language.
1. Visual Basic
2. Other Languages
3. Other project Types
4. Test projects


Tags: