Extremely Slow Asssembly Reflection under Memory Profile

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Extremely Slow Asssembly Reflection under Memory Profile

Postby michael.russell » Mon Aug 26, 2013 11:07 pm

Hi

We have an issue when profiling our application under Ants Memory Profiler. on start-up we have a procedure that scans all types in an assembly.

foreach (Type type in assembly.GetTypes()) {
...
}

Outside of the memory profiler this takes about 10 seconds, but when memory profiling, it takes about 50 minutes. assembly.GetTypes is what takes the time as I have tried putting the result into an array before the foreach.

It doesn't seem to matter whether it is .net 3.5 or .net 4.0.

This issue does not happen in the Ants performance profiler.

Has anyone had a similar issue and if so, how can we work around this.

Thanks.
michael.russell
 
Posts: 4
Joined: Mon Aug 26, 2013 10:55 pm

Postby james.billings » Wed Aug 28, 2013 12:02 pm

Thanks for your post.

We've not seen this behaviour before, unfortunately. If you're using the v8 Beta, then we're aware this can slow things down a little if unmanaged profiling is enabled but nowhere near to the extent you are seeing.

Another theory is that there are PDB files present for the assemblies in question, and source-code location these refers to is on a network drive / non-existent drive-letter on the profiling machine etc. Another possibility is your AV software doing something unusual when the assemblies are loaded so it could be worth turning that off.

One of our developers did do a quick test that does something similar on mscorlib, but the difference was negligible (just under a second without the profiler, around 2s with, and 3s with unmanaged enabled in AMP8.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby michael.russell » Thu Aug 29, 2013 2:06 am

We are using version 7.4. All of the application is on a local hard drive on my computer. I don't have any AV software running.

It could be related to the size of the assembly is quite large, it is 16mb in size with a 27mb PDB file, there are about 6000 types in it.
michael.russell
 
Posts: 4
Joined: Mon Aug 26, 2013 10:55 pm

Postby james.billings » Thu Aug 29, 2013 7:34 am

That's possibly the problem then- we do run code for each type loaded so with that many it could account for the delay, but it does sound pretty slow.
Is it possible we could obtain the assembly along with a simple calling app to test here and see if we get the same? If so, I can create you some FTP space to put it in.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby michael.russell » Thu Sep 05, 2013 5:43 am

This problem only occurs when running in 64-bit mode, using 32-bit mode the application starts up in 3 minutes 30 seconds, in 64-bit mode, it takes about 50 minutes.

I have confirmed this by changing the platform target back and forth.
michael.russell
 
Posts: 4
Joined: Mon Aug 26, 2013 10:55 pm

Postby michael.russell » Thu Sep 05, 2013 5:44 am

For memory profiling since our applications deal with large amounts of data, using 32-bit mode is not a good workaround for us.
michael.russell
 
Posts: 4
Joined: Mon Aug 26, 2013 10:55 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests