I am profiling an application using sampling in VS 2012 (although the profiler doesn't matter that much). I have a good lead on where the performance bottleneck lies, however, I'm hampered by the fact that there's a lot of memory allocations going on, and the garbage collector seems to be significantly skewing my profiling (I can somewhat see the GC effects in CLR Profiler and Concurrency Visualizer).
Is there a way to somehow get rid of the samples acquired while the GC is running? I could use any of these:
- Ignore samples collected while a GC is running (filter by function pointer?)
- Separate time spent GCing and the time spent actually working
- Increase GC limits to effectively "turn it off" for profiling
- Actually turn off the GC
The problem is that I pretty much don't know what I need to optimize. Attempts at optimizing the GC by reducing allocations etc. had very low real impact on release versions without a debugger attached, so I really want to know how much of the profiling results are due to disabled optimizations etc., and how much is code that could be improved (the code in question is used by a large portion of our projects, so even a 10% increase in performance would have huge impact).