Optimization
Optimization
[A flow chart is shown with three boxes connected with two arrows. The first box is rectangular:] Are you prematurely optimizing or just taking time to do things right?
[From the first box there is a short arrow straight down to a diamond shaped box:] Are you consulting a flowchart to answer this question?
[A labeled arrow continues down.] Yes
[The arrow connects to the final rectangular box.] You are prematurely optimizing

In computing, program optimization is the practice of making a computer program work as quickly as possible, typically by designing it to perform the fewest calculations. " Premature optimization " is the practice of trying to optimize parts of a program before such optimization has been shown to be needed. Optimization can prove to have been a waste of time if parts of the program are later changed or discarded, or if the optimized code is only a small part of the workload. Making a routine 10 times faster doesn't help much if that routine is only consuming 1% of the running time to begin with and it may result in more complicated and buggier code.
This comic is a flowchart making fun of the difference between prematurely optimizing and doing things right in the first place: it tells you that if you are using it to decide whether you are optimizing prematurely, then you're optimizing prematurely. The humorous conclusion is that if there is any doubt whether an optimization is premature , then it is premature !
Another layer of humor is provided by the minimalism and directness of the flowchart, which suggests that it has itself been (prematurely?) optimized.
The title text's root of all evil refers to Donald Knuth 's paper "Structured Programming with Goto statements" (1974) [1] in which he wrote:
The title text takes the joke a step further by proposing optimizing a brand new project by introducing a procedure to determine whether a possible optimization is premature - which is obviously a premature optimization. It pokes fun at time-wasting behavior by obsessively perfectionist coders who develop tools to analyze aspects of their software, such as performance. In some fields, such as compilers or database design, such tools can be useful and productive (the 3% mentioned by Knuth?), but the usage suggested here is more appropriately covered by instinct, common sense, and observation of the behavior of the completed program.
The title text may also be poking fun at the comic, since the comic itself may be the "system" used to determine premature optimization.
Flowcharts are often used in xkcd including the (mostly) non-farcical 1688: Map Age Guide one week prior to this comic. Inefficiency (another xkcd theme) was featured in the comic prior to this one .
[A flow chart is shown with three boxes connected with two arrows. The first box is rectangular:] Are you prematurely optimizing or just taking time to do things right?
[From the first box there is a short arrow straight down to a diamond shaped box:] Are you consulting a flowchart to answer this question?
[A labeled arrow continues down.] Yes
[The arrow connects to the final rectangular box.] You are prematurely optimizing
