free geoip Use Generics To Improve Performance - Jayson's Blog - jaysonKnight.com
jaysonKnight.com
Welcome to my corner of the internet
Use Generics To Improve Performance

Via Keyvan Nayyeri (full post here):

Generics were of one of main new features in .NET 2.0 languages. In .NET 1.x developers had to use System.Collections strongly typed collections to save their objects but no type checking were occurred for them. Therefore they had to do a type casting when they were retrieving their objects from collections.

Now that Microsoft introduced Generics as a type specific alternative for those old means, life is pretty easier for each developer. One of most important reasons to use Generics instead of strongly typed collections is performance.

As you don't need to cast an object as what you did when you read it from a collection such as ArrayList your performance will be improved.

Obviously each and every developer should try to use Generics in his code but what's the actual effect of using them on performance?

In this post I want to write some test codes with Generics and strongly typed collections then run them and use Visual Studio performance sessions to get some statistical information and compare these two new and old approaches to show you the influence of using Generics on performance.

The post goes on to demonstrate some of the performance benefits of using generic types over their non-generic predecessors (though I'd love to see more benchmarks!).  Generics is an area of .Net 2.0 I definitely need to brush up on.


Posted Mon, Aug 21 2006 4:45 PM by Jayson Knight

Comments

Keyvan Nayyeri wrote re: Use Generics To Improve Performance
on Mon, Aug 21 2006 8:33 PM

Seems Rick was here :-P

Add a Comment

(optional)  
(optional)
(required)  
Remember Me?

Copyright © :: JaysonKnight.com
External Content © :: Respective Authors

Terms of Service/Privacy Policy