Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M0070

Premature Optimization

Premature Optimization
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

Optimizing before identifying the bottleneck adds complexity and waste.

Definition

Premature optimization means investing substantial effort in small performance improvements without adequate requirements or measurements, potentially adding complexity for little benefit. Knuth criticized excessive attention to small efficiencies while emphasizing opportunities in critical parts; this does not prohibit early consideration of algorithms or performance goals.

How to use

Require a goal, measurement basis, and expected benefit for performance work so effort is directed toward bottlenecks that affect user requirements.

Mechanism

Prematurely polishing details when requirements and bottlenecks are unclear wastes resources and is often based on wrong assumptions, making the system harder to modify.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Hypothetical example: A team proposes hand-optimizing a rarely called function, but measurements show that repeated database queries dominate request time. Reduce repeated queries and measure again before deciding whether to change that function.

Common pitfalls

  • Do not interpret the warning as a reason to postpone all performance work until the end; late changes to algorithms, data structures, or capacity constraints may require a rewrite. Cleanliness and performance are separate judgments, and optimization should be assessed against goals and evidence.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Program_optimizationEN · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS