Pages

Visual Studio Performance Wizard

Hello Folks,

Today I will tell you about how to compare the performance of two methods.
I will take a simple example where in I will compare the performance of Int32.Parse(string),
Int32.TryParse(string, out int) and Convert.Int32(string).

Here we go
     1.Create a C# project and give it a name of your choice. I give it the name PerformanceWizard
     2.Now Create a method and copy this code inside Main










3. Build the application, go to Analyze tab and select Launch Performance Wizard










    
  4.  A 3 step wizard window will appear.
Step 1:














Step2:














  
      Step 3:























                                                                                      
      
5. Click Finish and you can see a Performance explorer  on the left side of your Visual Studio.
   6. Build the application.
   7. On build success, click on the Launch with Profile icon and  select Launch with Profile option.










 
    


8. Performance wizard will run and generate Performance Report Summary

















     


9. This is how we can compare the performance of different methods using Visual Studio Performance Wizard.     
10. Also from the above sample its vary clear that performance wise Int32.TryParse(string, out int) is slowest.
11.There various other option that Performance wizard provide. 

    Feel free to explore other feature, and do let me know if you find something interesting.