Do you profile your code when optimising performance?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
No component provided for introEmbed

We recommend that you should always use a code profiling tool to measure performance gains whilst optimising your application. Otherwise, you are just flying blind and making subjective, unmeasured decisions. Instead, use a tool such as JetBrains dotTrace profiler. These will guide you as to how to best optimise any code that is lagging behind the pack. You can run this on both ASP.NET and Windows Forms Applications. The optimisation process is as follows:

  1. Profile the application with Jetbrains dotTrace using the "Hot Spot" tab to identify the slowest areas of your application
Image

Figure: Identify which parts of your code take the longest (Hot Spots)

  1. Some parts of the application will be out of your control e.g. .NET System Classes. Identify the slowest parts of code that you can actually modify from the Hot Spot listing
  2. Determine the cause of the poor performance and optimise (e.g. improve the WHERE clause or the number of columns returned, reduce the number of loops or use a StringBuilder instead of string concatenation)
  3. Re-run the profile to confirm that performance has improved
  4. Repeat from Step 1 until the application is optimised

Acknowledgements

Adam Cogan
Ryan Tee
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star