Hi guys,
We are developing an application using DynamicProxy, and it has worked fine until now. A certain operation (which involves creating 69 proxy objects) takes an extensive period of time when running the application.
I did an analysis of the problem and my conclusion is this:
- When running inside Visual Studio (debugger attached), it takes around 20 seconds for the operation to complete.
- When running without debugger (Ctrl-F5), it takes around 2 seconds, with the exact same build of the code.
- When changing the object instantiation to use the "regular" non-proxy class, the operation takes around 6 seconds (with debugger attached).
So... there you have it. Something with the way my code/DynamicProxy works is making it slow down quite a lot when running with debugger. Any ideas?
I tried enabling "Just My Code" but it didn't make any difference.
The problem is that when running in e.g. the ANTS Profiler (which I have a license for), I'm getting the "medium-fast" behavior so I cannot really track the problem that way either... :-)
(Initially, there was a problem with the way I was doing the proxy generation. I instantiated a new ProxyGenerator each time I needed a proxy object, which is obviously the wrong way to do it. That showed a performance hit in ANTS, but it now looks OK when I look at the profiling results there. So, DP "should" really not be the problem here, but still...)
--
Best regards,
Per Lundberg