The Root of the Root of All Evil
Following in the footsteps of last year’s The Big OOPs, I once again decided to do a research-intensive talk for this year’s Better Software Conference. Last time, my starting point was Ivan Sutherland’s Sketchpad. This time, it’s the phrase, “premature optimization is the root of all evil.”
When people bring up this phrase, they typically want to debate its proper application, use it to argue a point, or divine which legendary computer science figure originated it. In this new talk, The Root of the Root of All Evil, I do none of those things.
Instead, I try to give as complete a picture as I can of the specific circumstances that lead to the phrase being coined. The more research I did on the historical figures involved, the more I came to believe that you can’t really grasp all the subtleties of the original meaning without knowing each of their stories: you’ll either read too much into the phrase, or too little, and miss the subtle understanding necessary to apply it properly.
So, if you’ve ever wondered what “premature optimization is the root of all evil” really means - or wondered why a prominent programmer would have said it - I hope you’ll join me for one more journey back into computer science history to search for The Root of the Root of All Evil!
Picture Credits
Nearly all of the photographs used in the talk came from Brian Randell’s fantastic NATO conference history pages. They are credited to both Randell and his contemporary, Robert McClure. Randell actually appears briefly in the talk proper - he is Dijkstra’s primary interlocutor in the inciting incident for GOTO Considered Harmful.
Unfortunately, at the time I am writing these credits, the server hosting Brian’s page seems to be experience SSL certificate issues. It is a wonderful page, with rare historical photographs, so hopefully this will be resolved soon! If it isn’t, you can try accessing a backup version of the page at the internet archive.
For the remaining photos: The pictures of Donald Knuth’s books were taken by Héctor García-Molina, and are available to download directly from Donald Knuth’s web site. The picture of Donald Knuth himself, as well as the photograph of his long-time collaborator Robert Floyd, appear in many places on the internet, and in books, but never with attribution. If anyone knows the original sources of these two photographs, I would be grateful if you could let me know so I can properly credit the photographer(s) here!
Slide References
As you might imagine, to prepare a talk like this I read through a large volume of historical material. My research directory for The Root has over 200 documents in it! From those sprawling thousands of pages, only a select few excerpts make it onto actual slides.
Each quotation slide bears a footer saying where it came from. If you’d like to read the document behind a slide in more detail, I’ve included a hyperlinked list below to help you find them. Where possible, I have linked to a publicly available version of the material if it appears to have been legitimately posted (ie., not pirated).
In the order in which each appears in the talk, the excerpts are from:
- ACM Computing Surveys, Volume 6, No. 4
- Structured Programming with go to Statements
- The Errors of TeX (paid access only)
- EWD196 - The Structure of the “THE”-Multiprogramming System
- Edsger Wybe Dijkstra - His Life, Work and Legacy (paid access only)
- An Interview with Edsger W. Dijkstra
- EWD215 - A Case against the GO TO Statement
- Go To Statement Considered Harmful
- EWD1308 - What led to “Notes on Structured Programming”
- EWD245 - On Useful Structuring
- EWD340 - The Humble Programmer
- Datamation - October 1968 (original scan preserved thanks to Bitsavers)
- Datamation - December 1968 (original scan preserved thanks to Bitsavers)
- EWD227 - Stepwise Program Construction
- A Review of “Structured Programming”
- NATO Software Engineering Conference 1968 Report (at the Internet Archive, since Brian Randell’s page is currently down)
- EWD249 - Notes on Structured Programming
- EWD209 - A Constructive Approach to the Problem of Program Correctness
- The Emperor’s Old Clothes
- Efficient Production of Large Programs
- A Contribution to the Development of ALGOL
- Record Handling
- Oral History of Sir Antony Hoare
- Structured Programming
- Oral History of Donald Knuth
- Research in the Computer Science Department (1969)
- Notes on Avoiding “go to” Statements (paid access only)
- The IBM System/360 Model 91 (paid access only)
- Optimal Measurement Points for Program Frequency Counts (paid access only)
- An Empirical Study of FORTRAN Programs (paid access only)
- The Execution Time Profile As A Programming Tool (as far as I could find, no digital version exists at the time of this writing)
- An Interview with Charles Antony Richard Hoare
- The Debugging of Computer Programs (paid access only - only appears in the Q&A)
You Never Know What You Might Find
I realize these days it’s a hard sell to convince people to spend time reading historical documents. Why not just have an AI do it for you?
Personally, I find the literal act of going through the documents to be the most valuable part of the experience. The primary reason for this is that an overall sense of the material is what matters more than any particular fact, and it’s not possible to get that without spending a considerable amount of time immersed in the historical record.
But a secondary reason is that it’s impossible to know beforehand all the facts you might want to look for. Every time I go spelunking in computer science history, I always happen upon dozens of fascinating artifacts that I was never specifically looking for. It might be Doug Ross’s invention (and use) of fat structs in the 1950s, Bjarne Stroustrup doing “Dependency Injection” in 1979 (more on that later), or, this latest time, finding Sir Charles Antony Richard Hoare proposing what appears to be static single-assignment form… in 1965!
SSA - a mainstay of compiler construction still used in today’s most popular backends - was supposedly developed in the 1980s at IBM. Though I’ve never done any research into that claim (or its history), while doing research for The Root, I stumbled upon the following passage in an unpublished IFIP proposal of Hoare’s:
Firstly, the program is transformed into an identically equivalent program from which all inner blocks have been removed, and in which no identifier occurs more than once on the left hand side of an assignment statement. The satisfaction of these conditions is made possible by the absence of go to statements, conditional statements, and for statements from the language of the translation routines. The next stage is to rearrange [the] sequence of the statements of the program in such a way that every variable occurs on the left hand side of an assignment before its first occurrence on the right hand side. This can be done by the same topological sorting algorithm that is widely used in PERT programs.
Hoare proposes the SSA-like transformation for the exact same reason as it was eventually developed (and for which it is still used to this day): as an internal representation structure for multi-pass compilers.
So why did the world have to wait another 15 years for compiler authors to develop SSA proper? According to the handwritten note added to the proposal’s coversheet by Hoare in 1998:
As a result of negative comments of Naur at the congress, I never wrote this up for publication. He said writing a nine-pass compiler was easy.
The “Naur”, in this case, is Peter Naur, whose name you may recognize from the term “Backus-Naur Form”, which is used ubiquitously to refer to a notation style for defining programming language syntax.
That’s A Wrap
I hope you enjoy The Root of the Root of All Evil. As with The Big OOPs, I once again learned a tremendous amount about the history of computing while preparing it. But, also like The Big OOPs, I came away with the inescapable feeling that I’d only just scratched the surface.
I’m not sure if I’ll do another one of these talks in the future. They’re extremely stressful to prepare, because the volume of information you’re trying to streamline is immense - far larger than any other kind of talk I’ve ever given. There is always more research you could do, and nagging questions whose answers might exist in some obscure document you just haven’t yet found. I am typically making slides right up until the moment I give the talk, and I never get the chance to do a proper rehearsal beforehand.
But I doubt I’ll ever stop nosing around in computer science history. There’s so much great stuff, I’m sure I’ll never exhaust it. As an industry, sadly, it feels like we’ve forgotten far more than we’ve retained.
On that note, since this is the one-year anniversary of The Big OOPs, I’ve also prepared a special hour-long, members-only video where I do my best to show what it’s like to read through the historical materials used to prepare these two unusual talks. It attempts to condense an over-500-page slice of Big OOPs research into one hour, which of course requires my best impression of the latest TikTok “fast talking” style. For all you OOP fans out there, it also includes the aforementioned finding that Stroustrup proposed dependency injection in the late seventies.
I will be posting that video here as a follow-up, so if you’d like to be notified when it’s live, please check out our subscription options:
Until next time, have fun programming everyone, and I’ll see you on the Internet.
— Casey
Regardless of who coined it, since some - including at times its most likely originator, Donald Knuth - have attributed it to others.