Richard Grimes has an interesting article over
here analysing how much of the .NET Framework versions 1.0, 1.1, 2.0 and WinFX December CTP are actually implemented in terms of .NET code rather than by invocation to unmanaged code.
I'm not sure to what extent people worry about how the .NET Framework is implemented. I've used the Win32 API for a long time without really worrying to what extent it is really just a wrapper over NTDLL and whether it was written in C or C++ or assembler. I've never really minded as it didn't have any impact on me as long as Microsoft kept shipping and maintaining the Win32 API and all the other bits underneath it which they did.
There are figures in the article for;
% of code written in IL
% of methods called that are IL
I had a look at the tables for;
If I read it right the code in IL figure starts at 92.6% for V1.0 and ends up in V2.0 at 92.8%. In the WinFX version it reaches 96.2%.
Again, if I read it right, the methods called figures start at 95.5% for V1.0 and ends up in V2.0 at 94.6%. In the WinFX version it's at 97.3%.
So the percentages vary a little from release to release but it doesn't seem like there's anything particularly radical going on but it's an interesting article and it set me thinking.
One of the big themes (for me anyway) of .NET 2.0 was that it was meant to provide managed API's onto more of the platform that 1.0 had missed out due to time constraints.
For example - 2.0 includes classes for setting up ACLs. It also includes classes for manipulating the Console, dealing with Serial Ports and managing X509 certificates. This is new .NET Framework functionality but I'd very much expect it to largely be just wrappering of the existing Win32 functionality that already exists.
So…I'd expect that someone writing System.Collections for .NET 1.0 would write a lot of .NET code and very little unmanaged code (probably none). However, I'd expect that someone writing System.Security.AccessControl for .NET 2.0 would be doing very little other than platform invoke calls to Win32 APIs that have been around for ages.
I'd also expect that someone writing WCF for WinFX would be writing a lot of .NET code - it's only a guess but I'd figure that's how it was. I'd guess a big chunk of WPF and WF are managed as well - certainly the WPF architecture diagram and the sheer number of .NET classes make it look like there's an lot of managed code in there.
So, if I'd had to guess then I'd have thought that maybe 1.0 would contain more managed code than 2.0 and WinFX would contain more managed code than either of them.
By the looks of it with the version of WinFX used here my guess would be right and my guess about 2.0 is right on one figure but a bit out on the other figure.
Now…as I said earlier on, whether anyone really minds how this stuff is written is another story but it's still interesting :-)
Posted
Thu, Jan 12 2006 12:55 AM
by
mtaulty