Reflection performance

Reflection performance

Old forum URL: forums.lhotka.net/forums/t/5245.aspx


dlambert posted on Thursday, August 14, 2008

I just came across the following link - it talks about techniques to speed dynamic method invocation dramatically.

http://msmvps.com/blogs/jon_skeet/archive/2008/08/09/making-reflection-fly-and-exploring-delegates.aspx

I'm not sure how applicable this is for CSLA (you have to know the signature of the method you want to call at compile-time), but I thought this might be interesting reading for folks here.  There's one place in 3.5.1 (that I found) that already uses the Delegate.CreateDelegate() technique, but there may be other spots that could use this, too.

RockfordLhotka replied on Friday, August 15, 2008

There are three areas in CSLA with lots of dynamic calling:

  1. Data portal
  2. UndoableBase
  3. DataMapper

In 3.5 and higher, the data portal (which is the most critical of the 3) uses dynamic method invocation to avoid reflection. That's thanks in large part to Ricky Supit, a long-time member of the forum, who helped me get that implemented.

The DataMapper is next on my target list - but I haven't had time to work on it yet.

UndoableBase would benefit greatly, but since undo is almost always a pure client-side behavior, wasting some CPU cycles on the client isn't such a big deal.

Copyright (c) Marimer LLC