Last week I blogged about a performance problem I helped a colleague debug. The root of the problem was reflection based cloning of objects. Reflection based cloning can be great for maintainability and productivity, but in some cases you might get into troubles. At least if you don't know that the classes you're using are using reflection.
Anders Norås followed up on my post and blogged about other ways to implement object cloning. Yesterday he posted a great example on how to get blazing fast reflection in .NET. In his post Anders discusses how you can use the CodeDOM to generate reflection optimizers and compile them to in-memory assemblies . An even better alternative is the Lightweight Code Generation (LCG) feature of .NET 2.0. In his example cloning a customer class one million times takes about one minutte using pure reflection. The bytecode enhanced reflection takes about 175 milliseconds. Now that's some serious performance.
"...You have a couple of options for doing optimized reflection on .NET. In general you will use the CodeDOM to generate the optimizers on .NET 1.x, while you'll use Lightweight Code Generation (LCG) on .NET 2.0. LCG bridges the gap between purely dynamic invocations and statically bound calls. The LCG feature provides the means for generating dynamic methods at runtime..." (from Anders Norås blog)
Anders has several other interesting posts on both Java and .NET development. His posts on DSL's and a LINQ implementation on Java is really interesting reading well worth checking out.
Remember Me
a@href@title, strike
Page rendered at Sunday, August 01, 2010 6:40:09 AM (W. Europe Daylight Time, UTC+02:00)
Powered by newtelligence dasBlog 2.3.9074.18820
© Copyright 2010, Jonas Follesø
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
This blog theme is inspired by a theme original designed and copyrighted 2007, by Alexander Groß and is used with his explicit permission.