Found this little C# app on iDesign’s download page to demonstrate perf gains with generics. (scroll down on page and look for Generics Performance.) These are demos from iDesign’s classes. I believe it’s the same demo that is in Juval Lowy’s C# Generics MSDN article.
From the iDesign downloads page:
When using value types in a generic type there is typically a 200 percent performance gain, and with reference types you can expect up to a 100 percent performance gain. This demo is a micro-benchmark application, which executes a stack in a tight loop. The application lets you experiment with value and reference types on an Object-based stack and a generic stack, as well as changing the number of loop iterations to see the effect generics have on performance.
I am finding it painful to try to help people understand generics in such a small amount of time. I have to keep reminding myself – it’s an introduction, an overview, a look, a hit list, a reference. But it is SO satisfying to help someone get to that “oh!” of real understanding and uncomfortable to knowingly leave them hanging.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!