Spiking Rhino Proxy - Dynamic Proxy on CodeDOM
What is Rhino Proxy?
Rhino Proxy is a little spike of mine, duplicating the work that has gone into Dynamic Proxy, but using CodeDOM, instead of Reflection.Emit.
The good news is that it took me about 3 days to duplicate nearly all the the functionality in Dynamic Proxy (I didn't do events, but it should be easy enough to do).
The really good news are that I managed to support generics methods interceptions, so interfaces like this are now valid:
public interface GetData
{
T Get<T>(int id);
}
The bad? Here is Task Manager when I run the tests (~70) using Rhino Proxy:
Here is Task Manage when I run the tests (same amount) using Dynamic Prxoy:
The timing are also about twice as slow for the tests in Rhino Proxy vs. Dynamic Proxy. ~8 seconds for Dynamic Proxy vs. ~22 seconds for Rhino Proxy.
So, it is slower, more CPU intensive, and probably uses more memory. Why is it useful? It is useful because it is a proxy implementation that doesn't take a genius to build. It means that I may be able to resolve this bug which is hanging around for about a year.
I got a couple ideas about implementing offline caching and maybe doing batch compilations at once, which will probably be able to improve performance signifacntly. But I believe that Dynamic Proxy will always be faster, simply due to the lower level nature of Dynamic Proxy.
Anyway, I currently have all of Dynamic Proxy's tests working, and 426 (out of ~480) of Rhino Mocks' tests passing. You can check the code here.
Take into account that this is just a (fairly big) spike, and I have no idea what its future will be.
Comments
Comment preview