Wednesday, May 12, 2004

Five things I love about VS 2005 (from a performance perspective)

Generics



Boxing was the scourge of value type performance, and in some of the tests I did
for Maximizing
.NET Performance
, the performance hit of boxing was well over an order of
magnitude.  Generics eliminate this problem, and this will be a huge win for all
.NET programmers lucky enough to use a language that exposes generics.


GC.AddMemoryPressure



In .NET 1.x, a type author had no effective way of telling the garbage collector
how much non-managed memory resources were kept alive by the presence of a
particular object.  Take a database connection.  Having one of these objects
around and open is a considerable drain on general system resources, and if they
are being leaked, we'd generally like to have more garbage collections to
prevent resource exhaustion.  The problem is that a database connection object
use only a couple of dozen bytes of managed memory, and will exert very little
pressure on the GC.  AddMemoryPressure can be used to give the CG a hint that a
particular object uses a lot more resources than its managed footprint would
indicate, and should be given special treatment when deciding on collection
frequncy.


.NET 2.0



As with every major release, many small imperceptible improvements combine to
produce a significantly faster experience.


Improved and expanded runtime hosting options



Hosting the CLR inside even the most performance-sensitive applications becomes
feasible with the extra fine-grained control offered by the new hosting
interfaces.  If its good enough for Yukon …


MSBuild



Being able to hook into things like the compile process at a very low level will
allow clean performance optimizations that
we haven't even dreamt up yet.