Research Log: Origin of “Premature optimization is the root of all evil”
Sequential record of discoveries during the investigation — documents, personalities, events, institutions. Compiled July 16, 2026. (A synthesized report is issued separately.)
Pass 1 — Establishing the primary source
DOC Located the canonical full-form quotation in Donald E. Knuth, Structured Programming with go to Statements, ACM Computing Surveys, Vol. 6, No. 4 (December 1974), pp. 261–301; the sentence appears at p. 268 in the section titled “Efficiency”: We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. No attribution to anyone else appears at this point in the text.
DOC Found a second 1974 Knuth occurrence, in weaker form: Computer Programming as an Art (1974 ACM Turing Award lecture), printed in Communications of the ACM 17(12), December 1974, p. 671: premature optimization is the root of all evil (or at least most of it) in programming. The lecture cross-references the Computing Surveys paper (“my paper on structured programming, which appears in the current issue of Computing Surveys”), so the two 1974 texts are contemporaneous and mutually aware.
DOC Identified the document responsible for the rival attribution: Knuth, The Errors of TeX, Software—Practice & Experience 19(7), July 1989, pp. 607–685 (reprinted in Literate Programming, CSLI, 1992, p. 276), where Knuth writes: But I also knew, and forgot, Hoare’s dictum that premature optimization is the root of all evil in programming. Fifteen years after coining it, Knuth credits it to C. A. R. Hoare — with no citation.
PERSON Cast of the attribution dispute now fixed: Donald E. Knuth (Stanford), C. A. R. “Tony” Hoare (then Queen’s University Belfast → Oxford), Edsger W. Dijkstra (Eindhoven → Burroughs) as a third-hand candidate.
Pass 2 — The Hoare disclaimer and the modern investigators
DOC Retrieved Hans Gerwitz’s blog post “Premature optimization is the root of all evil” (hans.gerwitz.com, August 12, 2004; originally on phobia.com, preserved also in the Wayback Machine). Gerwitz emailed Hoare directly in January 2004; Hoare replied: I’m sorry I have no recollection how this quotation came about. I might have attributed it to Edsger Dijkstra. I think it would be fair for you assume it is common culture or folklore. Hoare thus explicitly declines authorship.
DOC Found the corroborating citation in Peter Seibel’s book Practical Common Lisp (Apress, 2005), final chapter, footnote 4, which reports the 2004 Hoare email — though it misspells the correspondent as “Hans Genwitz.” First recorded error in the secondary literature noted.
PERSON Bruce Eckel identified as a secondary propagator of the Dijkstra attribution (in Thinking in Patterns introduction), independent of Hoare’s guess.
DOC Retrieved the key forensic survey: Shreevatsa R., “Premature optimization is the root of all evil”, The Lumber Room blog, May 16, 2008 (updated July 2010). It assembles the 1974 texts, the 1989 “Hoare’s dictum” passage, and the 2004 Hoare email, and concludes the phrase is Knuth’s alone; characterizes the Hoare attribution as a short-circuit of Knuth’s original (uncited) attribution. Notes that no one has ever produced a pre-1974 Hoare citation for the sentence.
Pass 3 — Closing the loop with Knuth himself
EVENT March 2012: Mark Harrison (prompted, coincidentally, by the same Shreevatsa R. challenging an unsourced Knuth quote on Stack Overflow) wrote to Knuth; Knuth replied in a handwritten note, scanned and published on Harrison’s blog “EastBay CodeHaus” (March 6, 2012): I did say things like ‘Premature optimization is the root of all evil in programming’… — a direct, first-person confirmation of authorship, in the same breath as his confirmation of the “Beware of bugs in the above code” quip.
DOC Noted that Knuth’s 2012 wording (“…in programming”) matches the Turing-lecture / Errors-of-TeX form rather than the Computing Surveys form — consistent with Knuth recalling the family of sayings rather than one canonical sentence.
DOC Edward Betts’s monograph page on “premature optimization” independently assembles the same three-document chain (Gerwitz 2004 → Harrison 2012), corroborating the sequence.
Pass 4 — Reconstructing the precipitating circumstances (the goto wars)
DOC Read the full text of the 1974 Computing Surveys paper (HTML transcription at kohala.com). The quote sits in a defense of a 12% hand-optimization of an inner loop (Example 2 → 2a, loop doubling): The conventional wisdom shared by many of today’s software engineers calls for ignoring efficiency in the small… In established engineering disciplines a 12% improvement, easily obtained, is never considered marginal. The famous sentence is the counterweight immediately following: efficiency abuse is real, so confine optimization to the measured-critical 3%.
EVENT The paper’s own “Historical Background” section supplies a chronology of the goto controversy: Heinz Zemanek’s doubts (1959); D. V. Schorre programming without gotos at UCLA (from 1960); Peter Naur’s first published remarks (~1963); George Forsythe purging gotos from CACM algorithms (1964); Dijkstra’s 1965 observations; Peter Landin at the 1965 ACM Programming Languages and Pragmatics Conference; the Böhm–Jacopini theorem (1966).
EVENT March 1968: Dijkstra’s letter in CACM 11(3), pp. 147–148. Knuth’s paper records the editorial handling: Dijkstra submitted an article; In order to speed publication, the editor decided to publish Dijkstra’s article as a letter, and to supply a new title, “Go to statement considered harmful.”
PERSON The editor identified: Niklaus Wirth, then a CACM editor. Confirmed by Dijkstra himself in EWD1308 (2001): his submission was titled “A Case against the GO TO Statement”; Wirth converted it to a letter and invented the “considered harmful” title. Dijkstra later told Knuth he received a torrent of abusive letters after publication.
DOC Located the empirical substrate of the 97%/3% figures: Knuth, An Empirical Study of FORTRAN Programs, Software—Practice and Experience 1(2), 1971, pp. 105–133 — a summer-1970 Stanford study (Knuth plus about a dozen students and industry representatives) profiling FORTRAN programs; principal conclusion: the importance of the program “profile,” with a small fraction of code dominating running time. The 1974 paper cites this ([51]) plus Dan Ingalls’s execution-time profiling work ([46]) for the claim that most of the running time in non-IO-bound programs is concentrated in about 3% of the source text.
DOC Identified the “conventional wisdom” Knuth was pushing against, in its most quotable form: William A. Wulf, A Case Against the GOTO, Proc. 25th ACM National Conference, October 1972: More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason — including blind stupidity.
EVENT February 1974: Knuth lectured on this material at UCLA (recorded in the paper’s introduction); December 1973 Datamation had run five structured-programming articles; the paper was written amid peak structured-programming fervor, which Knuth compared to the intuitionism crisis in mathematics (Brouwer vs. Hilbert).
PERSON Institutions on the map: Stanford (Knuth); CACM / ACM Computing Surveys (ACM); Eindhoven & Burroughs (Dijkstra); Queen’s University Belfast (Hoare); Carnegie Mellon (Wulf); UCLA (Schorre; Knuth’s Feb 1974 lecture).
Pass 5 — Rhetorical ancestry and reception errors
DOC The rhetorical template is 1 Timothy 6:10 (KJV): “For the love of money is the root of all evil” — a proverb pattern (“X is the root of all evil”) already in wide parodic circulation long before 1974 (e.g., a Wikiquote note traces “the lack of money is the root of all evil” to an 1872 article by Richard Bowker). Knuth, a lifelong church musician and organist, wrote squarely inside this template; the borrowing is stylistic, not evidentiary.
DOC Catalogued recurring reception errors in the secondary literature: (i) wrong-venue citations — e.g., Stackify’s widely-read article places the quote in The Art of Computer Programming, “published… in the 1960s” (it appears in neither venue nor decade); (ii) truncation — the “97% / critical 3%” framing is routinely dropped, inverting Knuth’s point into a blanket anti-performance slogan (documented complaints at milen.me, Probably Dance, Josh Barczak’s “Stop Misquoting Donald Knuth!”); (iii) layered folklore — a Hacker News commenter’s summary that it’s an urban legend that it’s an urban legend that it was originally Knuth, i.e., even the debunking has been mis-debunked.
DOC Confirmed no evidence stream supports a pre-1974 utterance by Hoare or Dijkstra; the Dijkstra candidacy exists only as Hoare’s 2004 conjecture and Eckel’s unsourced credit. Verdict for the report: authorship Knuth, December 1974, in two simultaneous publications; the Hoare attribution is Knuth’s own 1989 memory error.
Pass 6 — Supplemental verification: the 97/3 substrate and the Structured Programming book (added July 17, 2026)
DOC Re-examined the 1971 study’s structure via its abstract and an OCR’d copy of the Stanford tech-report version (Stanford AI Memo AIM-137 / CS Report CS-186). Design confirmed: a three-month summer-1970 project (Knuth plus about a dozen students and industry representatives); a static arm analyzing statement-type frequencies across a corpus of FORTRAN programs chosen “at random”; a dynamic arm in which about 25 programs were selected at random and profiled with statement-execution frequency counts; the “inner loops” of 17 programs examined in additional detail. Principal stated conclusion: the importance of the program “profile,” and that profile-keeping should become standard practice in all computer systems.
DOC Attempted to verify the exact wording of the study’s famous hot-spot sentence (commonly quoted as “less than 4 per cent of a program generally accounts for more than half of its running time”). Direct primary-text access was not obtainable in this pass (paywalled journal; tech-report mirror behind bot detection); the sentence is therefore carried in the report flagged as verified only via secondary reproduction, with a recommendation to confirm against Section 3 of the SP&E article.
DOC Resolved Knuth 1974 reference [46]: D. Ingalls, “The Execution Time Profile as a Programming Tool,” in Compiler Optimization, 2nd Courant Computer Science Symposium (1971), ed. R. Rustin, Prentice-Hall, 1972 — bibliographic details verified through the reference list of J. Cohen, SP&E 7 (1977). Later literature on profile-guided optimization cites Ingalls 1971 as the first realization that profiles could guide optimization.
PERSON Personality note: the Ingalls in question is Daniel H. H. Ingalls Jr., then a Stanford graduate student building FORTRAN profiling tools — subsequently the principal implementor of Smalltalk at Xerox PARC. The profiling-tools thread thus connects the 97/3 substrate to the later history of dynamic languages.
DOC Confirmed the layering for the report: “about 3%” (1974) is a rounded generalization of the 1970–71 hot-spot concentration finding, cited in the paper to [46] and [51]; “97%” is its arithmetic complement; “say about” marks both as estimates. Also logged Knuth’s personal layer: after working with such tools for seven years (1974) — i.e., profiling practice dating to roughly 1967.
DOC Clarified the role of the book Structured Programming (O.-J. Dahl, E. W. Dijkstra, C. A. R. Hoare; Academic Press, A.P.I.C. Studies in Data Processing No. 8, 1972): it is the proximate provocation for Knuth’s paper, whose opening sentence is It is impossible to read the recent book Structured programming without having it change your life. Contents: Dijkstra’s “Notes on Structured Programming,” Hoare’s “Notes on Data Structuring,” Dahl & Hoare’s “Hierarchical Program Structures.”
DOC Logged an interpretive observation (flagged as such in the report): Hoare’s dense presence in the 1974 paper — subscript checking, for-loop design, iteration axiomatics, and the fall-1973 optimizing-compiler remark Knuth credits with lifting a veil — plus his co-authorship of the 1972 book, offers a plausible associative mechanism for Knuth’s 1989 “Hoare’s dictum” memory slip. No document establishes the mechanism; it is inference, not record.