If you'd like to optimize the performance of your code, you first need to identify the bottlenecks. It may work to realize some optimization hints in the dark (for example those noted in ProgrammingTips), but in most cases it's more effective to analyze first and then optimize where needed.

To analyze the performance, you can use the build-in performance profiler of Visual Studio 2008 Team System. The Professional edition does not have a profile. Click in the Visual Studio menubar on Analyze -> Profiler -> New Performance Session. A new window should open on the left side of your workspace: the Performance Explorer. Right-click on Target, select Add Target Project and choose CrypWin. By default Sampling is chosen as measurement method which is ok in most cases.

Then you have to Launch with profiling from inside the Performance Explorer or the Analyze menubar. Do not start CT2 the usual way (F5 or Start Debugging will not work). Visual Studio will ask for administrator privileges in order to collect the performance samples. Run your plugin and do some performance intensive stuff you'd like to measure.

After closing CT2 a performance report should open. When you choose Modules from the dropdown box Current View and open your plugin assembly, you get a list of executed methods. You can double click on a method to browse through the call tree. For each method the number of Samples is shown: a Sample can be seen as time unit -- how long the method did run (this is not quite correct, but you get the idea). Inclusive Samples counts the samples of the chosen method and all executed submethods. Exclusive Samples counts the samples of the chosen method only, without submethods.

Last modified 10 years ago Last modified on Dec 15, 2009, 12:54:11 PM

Attachments (1)

Download all attachments as: .zip