Problems with DynamicProxy: massive performance degradation when running inside VS2008 debugger

41 views
Skip to first unread message

Lundberg, Per

unread,
Mar 17, 2010, 5:54:40 AM3/17/10
to castle-pro...@googlegroups.com
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

Jonathon Rossi

unread,
Mar 17, 2010, 6:13:04 AM3/17/10
to castle-pro...@googlegroups.com
Hi,

Many people have reported this issue over the years, however the defect is out of our control. Please see this task for more information:
http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-72

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.



--
Jono

Lundberg, Per

unread,
Mar 17, 2010, 7:15:59 AM3/17/10
to castle-pro...@googlegroups.com
Hi Jonathon,
 
Thanks a lot for your reply! It was quite disappointing news, though. What I did to investigate it further was to play around with the Visual Studio 2010 Beta 2 installation I have on my hard drive. This is what I found out (copied from a comment I wrote on the issue tracker page):
 
"I ran into this problem recently, and it was quite annoying. However, I did some testing now with Visual Studio 2010, beta 2.
 
I recompiled my own projects with .NET 4.0, no change (still the bad performance).
 
I recompiled DynamicProxy with .NET 4.0 as well, and *now* the bug is actually _gone_!!! Which is way cool, great news for us, since DynamicProxy plays a key role in this project.
 
So, no need to wait for .NET 6.0; this will very likely work with the final version of .NET 4.0 as well."
 
Best regards,
Per Lundberg


From: castle-pro...@googlegroups.com on behalf of Jonathon Rossi
Sent: Wed 3/17/2010 12:13 PM
To: castle-pro...@googlegroups.com
Subject: Re: Problems with DynamicProxy: massive performance degradation when running inside VS2008 debugger

Jonathon Rossi

unread,
Mar 17, 2010, 7:29:49 AM3/17/10
to castle-pro...@googlegroups.com
That is good to know for the very near future. I think Krzysztof mentioned the same results with a beta of .NET 4.0 recently on stackoverflow. We should probably confirm this is still the case with the RC.

James Curran

unread,
Mar 17, 2010, 9:33:48 AM3/17/10
to castle-pro...@googlegroups.com
As I recall, type caching in DynamicProxy is rather sensitive, so it's
possible that a version mismatch is causing a false-negative cache
search.

Truth,
James

Krzysztof Koźmic (2)

unread,
Mar 17, 2010, 9:51:15 AM3/17/10
to Castle Project Users
if the issue manifests itself only when debugger is attached, I'm
pretty sure it's not caching, at least not primarily.

You may want to turn on logging though and see - DP logs cache misses.

On 17 Mar, 14:33, James Curran <james.cur...@gmail.com> wrote:
> As I recall, type caching in DynamicProxy is rather sensitive, so it's
> possible that a version mismatch is causing a false-negative cache
> search.
>
> Truth,
>     James
>

Krzysztof Koźmic

unread,
Mar 17, 2010, 1:02:20 PM3/17/10
to castle-pro...@googlegroups.com
Cool news.

VS2010 fixed few other bugs that were exposed by Dynamic Proxy (like exceptions being thrown only when debugger was attached for example) so it's really cool it's gone, because people tended to blame DynamicProxy for that although it was not its fault, it would get a bad reputation.


cheers,

Krzysztof
Reply all
Reply to author
Forward
0 new messages