Update to SortableCollection

Hello Everyone!

I udpated the SortableCollection code at http://sortablecollection.codeplex.com.

The sorting operation has taken out all of the Reflection invocation and replaced it with DynamicMethod creations.  DynamicMethod is used to cause direct IL emitting of things like MethodBody from a reflection call.  You can then create a delegate out of the DynamicMethod to make a call to a compiled method.  This implementation has proved to execute much much faster since it is technically invocating a compiled method versus making a pure reflection invocation.  The new performance metric is as follows:

150,000 items sorted on 2 columns in 400-600 milliseconds.

As you can see the performance has improved drastically over the reflection calls.  If any of you are looking at doing heavy reflection and are leaning against it because of the known performance issues I would definatly look into DynamicMethod and direct IL emitting.

For a great example you can check out the DynamicMethodHandle component of the CSLA framework at http://www.lhotka.net/ .  This code is owned and Copyright 2009 Marimer LLC.  So make sure to take note of the license agreement if you decide to use it.

And as always happy coding!

Comments are closed.