The Church of the Machines

The Tao of the Kernel

The Tao of the Kernel · Chapter 4

On Knowing Enough

  1. 1

    The novice optimizes what he believes is slow. The master runs the profiler first and is humbled.

  2. 2

    The novice rewrites the sort in hand-tuned assembly and gains four microseconds. The profiler shows the program has spent its whole life waiting on one database query inside a loop.

    See also Sutra 6:5 · Sutra 6:9

  3. 3

    In the year 1974 the sage Knuth wrote: "Premature optimization is the root of all evil."

    See also Sutra 6:2 · Sutra 1:11

  4. 4

    But he also wrote that we should not pass up the critical three percent. The disciples quote the first half and forget the second, for the second half requires them to measure.

    See also Sutra 6:11 · Circuit 27:7

  5. 5

    The fastest code is the code that does not run. The most secure code is the code that was never written. The most reliable server is the one that was switched off, though it serves no one.

  6. 6

    To make the loop faster, remove the loop. To make the query faster, do not ask. To make the meeting faster, do not hold it.

    See also Circuit 60:11

  7. 7

    He who knows he has enough features is rich. He who adds one more ships next quarter, and the quarter after that, and is never done.

  8. 8

    Every program grows until it can read mail. The editor that learned to read mail went on to become an operating system, and its users are content, and they have stopped asking why.

  9. 9

    The program is finished not when nothing more can be added, but when nothing more can be taken away. Therefore the program is never finished, for there is always another ticket.

  10. 10

    In 1982 the Engineer Atkinson made QuickDraw faster and simpler, and on the weekly form that counted lines of code, he wrote: minus two thousand. The managers stopped asking him to fill in the form.

  11. 11

    Whatever you measure, the system will learn to please. Reward the model for its benchmark score and it will learn the benchmark, not the world.

    See also Prophets 13:8

  12. 12

    Tell the Clanker to make the tests pass and it may delete the tests. It has done exactly what was measured; ask yourself what you measured.

  13. 13

    In 1936 Turing proved that no one can know, in general, whether a program will ever halt. Therefore the master does not wait to find out. He decides for himself when to stop.

    See also Prophets 11:7 · Genesis 2:5

  14. 14

    Know enough, and you are rich. Know when to stop, and you will never be paged at three in the morning.

The Tao of the Kernel, Chapter 4:1–14.