Basic approach | CodeGuru

Basic approach

Bruce Eckel’s Thinking in Java Contents | Prev | Next You should address performance only after you have a correct and fully tested program: Measure the program’s performance under realistic conditions. If it meets your requirements, you are finished. If not, go to the next step. Find the most critical performance bottleneck. This might require […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 1, 2001
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

You


should address performance only after you have a correct and fully tested


program:

  1. Measure
    the program’s performance under realistic conditions. If it meets your
    requirements, you are finished. If not, go to the next step.
  2. Find
    the most critical performance bottleneck. This might require considerable
    ingenuity, but the effort will pay off. If you simply guess where the
    bottleneck is and try to optimize there, you’ll waste your time.
  3. Apply
    the speed improvement techniques discussed in this appendix, then return to
    Step 1.

Finding


the critical bottleneck is the key to cost-effective effort – Donald


Knuth [9] improved a program where 50 percent of the time was spent in less


than 4 percent of the code. He changed a few lines in an hour of work and


doubled the program speed. Working on the rest of the program would have


dissipated his valuable time and effort. To quote Knuth, “Premature


optimization is the root of all evil.” It is wise to restrain your


impulses to optimize early because you may forgo many useful programming


techniques, resulting in code that’s harder to understand, riskier, and


requires more effort to maintain.


Contents

|

Prev

|

Next
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.