development

Tim Bray gets the performance thing

June 12, 2003 8:30:10.465

Tim Bray points out the correct steps to good code:

Once you get past that pledge, the order of this essay goes quickly off the rails. Gray deals out several thousand words of detailed and useful information about performance issues in CLR, and only halfway through the essay does he introduce the "CLR Profiler" and give advice on how to measure what your code is actually doing. This is probably wrong, because I think the way to write fast code is simple and has been well-known for a long time. Here it is:

  1. Design and code your app, trying hard not to do anything really stupid, and striving for flexibility.
  2. If it's fast enough, don't worry any more.
  3. If it's slow, get out your profiler and measure things until you understand where the problem is.
  4. Fix the problem, which may well require major refactoring, but that's OK because that's probably coming at you pretty soon anyhow with the next batch of requirements. Furthermore, you couldn't have avoided it because nobody is smart enough to predict where the bottlenecks will be in a complex application before it's running.

That's a perfect summary of how to go about getting a clean, maintainable application that is as fast as it needs to be.

 Share Tweet This
-->