Pinpointing string concatenation with profiler  
Author Message
mmix





PostPosted: Visual Studio Performance Tools (Profiler), Pinpointing string concatenation with profiler Top

I have a specific problem that I cant seem to be able to resolve. I have inherited a big (200+ pages) asp.net 1.1 project in a bad shape. Performance counters indicate high CPU, big allocated bytes/sec, high % in GC and a lot of Gen2 collections. I have ported the project to .net2.0 and ran a few profiles on it (in both sampling and instrumental) and have found that about 50% of all allocated memory goes to String type and almost no activity in LOH (2 strings in total), so my first diagnosis is small strings concatenation abuse :)

Now this is what I cant seem to do is to create a call graph to + and += operators of string type, as looking for those in 200+ pages will be a nightmare, so any idea would be appreciated.

I tried to resolve this by checking the biggest exclusive allocators (methods) of string type (as concatenation indirectly cases strnig allocation) from a profile analisys but the results are weird at best. I get that the bigest exclusive allocator is Page.ProcessRequst(HttpContext) method, which cannot be true (I have reved this method and there are no string alocations in there, for that matter there are no allocations there at all; and none of the methods in ProcessRequest appear in call graph) so its quite possible I am not using instrumentation properly. What am I doing wrong




Visual Studio Team System41  
 
 
Ian Huff





PostPosted: Visual Studio Performance Tools (Profiler), Pinpointing string concatenation with profiler Top

With instrumentation allocations will be attributed to the first function up the callstack that you currently have instrumented. Since allocations come to our profiler globally (regardless of instrumentation) we often have to attribute them to functions higher up in the callstack, that should be what you are seeing with ProcessRequest.

Thanks,

Ian