Editing 1691: Optimization
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 8: | Line 8: | ||
==Explanation== | ==Explanation== | ||
− | In computing, | + | In computing, 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 its structure or function has been finalized. Optimization can prove to have been a waste of time if parts of the program are later changed or discarded. |
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''! | 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''! | ||
Line 14: | Line 14: | ||
Another layer of humor is provided by the minimalism and directness of the flowchart, which suggests that it has itself been (prematurely?) optimized. | 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 {{w|Donald Knuth}}'s paper "Structured Programming with Goto statements" (1974) | + | The title text's ''root of all evil'' refers to {{w|Donald Knuth}}'s paper "Structured Programming with Goto statements" (1974) in which he wrote: |
<blockquote> | <blockquote> | ||
"There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. 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%." | "There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. 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%." | ||
</blockquote> | </blockquote> | ||
− | + | *Source: http://web.archive.org/web/20130731202547/http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf (Computing Surveys, Vol 6, No 4, December 1974) | |
− | The title text | + | 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. |
Flowcharts are [[:Category:Flowcharts|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 [[1690: Time-Tracking Software|comic prior to this one]]. | Flowcharts are [[:Category:Flowcharts|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 [[1690: Time-Tracking Software|comic prior to this one]]. | ||
==Transcript== | ==Transcript== | ||
− | :[A flow chart is shown with three boxes connected with two arrows. The first box is rectangular:] | + | :[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?''''' | :Are you '''''prematurely optimizing''''' or just '''''taking time to do things right?''''' | ||
Line 37: | Line 37: | ||
:You are prematurely optimizing | :You are prematurely optimizing | ||
− | + | {{comic discussion}} | |
− | |||
− | |||
[[Category:Flowcharts]] | [[Category:Flowcharts]] | ||
− |