Friday 23 October 2015

ASP.NET Tips #38 - Prepare performance optimization projects in advance

Good performance optimization projects need appropriate preparation in four key areas:

  1. Create a test environment where you can reproduce consistent performance behavior. Ideally, you want an automated test that shows equal performance if you run it multiple times. Don't start optimizing without such a test environment.
  2. Measure performance KPIs before you change anything to serve as a benchmark. Compare the performance against the benchmark after changing the code. If the changes make the code faster, the new test results are your new benchmark. If not, undo the changes and continue to analyze with a profiler tool.
  3. Don't change too much at the same time. Make small changes, measure, and decide if you want to keep your change. If you make multiple changes, one change can make your code faster, while the other one might destroy the positive effects.
  4. Never guess, measure it! Get a profiler and use it to spot performance bottlenecks. In many cases, performance killers are where you don't expect them. Avoid optimizing code just because you have the feeling that it does not perform well.

No comments :

Post a Comment