---
title: "Premature optimization is the root of all evil (or at least most of i… — Donald Knuth Quote #1 | QuotesBy.net"
description: "Premature optimization is the root of all evil (or at least most of it) in programming. — a quote by Donald Knuth."
image: "https://quotesby.net/wp-content/themes/quotesby-editorial/assets/og-default.png"
---

> # Premature optimization is the root of all evil (or at least most of it) in programming.

[Donald Knuth](https://quotesby.net/Donald-Knuth)\#1

[Programming](https://quotesby.net/Donald-Knuth/programming/)[Development](https://quotesby.net/topics/development/)[Efficiency](https://quotesby.net/topics/efficiency/)[Priority](https://quotesby.net/topics/priority/)

[WhatsApp (opens in a new tab)](https://wa.me/?text=%E2%80%9CPremature%20optimization%20is%20the%20root%20of%20all%20evil%20%28or%20at%20least%20most%20of%20it%29%20in%20programming.%E2%80%9D%20%E2%80%94%20Donald%20Knuth%20https%3A%2F%2Fquotesby.net%2FDonald-Knuth%2F1%2F)[X (opens in a new tab)](https://twitter.com/intent/tweet?text=%E2%80%9CPremature%20optimization%20is%20the%20root%20of%20all%20evil%20%28or%20at%20least%20most%20of%20it%29%20in%20programming.%E2%80%9D%20%E2%80%94%20Donald%20Knuth&url=https%3A%2F%2Fquotesby.net%2FDonald-Knuth%2F1%2F)[Facebook (opens in a new tab)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fquotesby.net%2FDonald-Knuth%2F1%2F)

## About this quote

What does it mean?Optimizing too early causes more harm than good in programming.In plain termsDo not try to speed up code too soon.What can you take from it?Focus on correctness before speed.

### Where it applies

- coding
- development
- architecture

### Putting it to work

- write clean code first
- profile before optimizing
- avoid premature tweaks

### Questions to consider

- When is optimization right?
- How do you prioritize code?

### Another view

Some optimizations are needed from the start.

## More from Donald Knuth

1. > Beware of bugs in the above code; I have only proved it correct, not tried it.

[Permalink to quote \#2](https://quotesby.net/Donald-Knuth/2/ "Permalink to quote 2")
2. > I can't be as confident about computer science as I can about biology. Biology easily has 500 years of exciting problems to work on. It's at that level.

[Permalink to quote \#3](https://quotesby.net/Donald-Knuth/3/ "Permalink to quote 3")
3. > The psychological profiling \[of a programmer\] is mostly the ability to shift levels of abstraction, from low level to high level. To see something in the small…

[Permalink to quote \#4](https://quotesby.net/Donald-Knuth/4/ "Permalink to quote 4")

## Related quotes

1. > And in the limiting case where the optimizer is completely broken because it's not implemented yet, we get to work around that too. Optionally...

[Larry Wall](https://quotesby.net/Larry-Wall)[Larry Wall quote \#234](https://quotesby.net/Larry-Wall/234/ "Permalink to quote 234")
2. > Simplicate, then add lightness.

[Colin Chapman](https://quotesby.net/Colin-Chapman)[Colin Chapman quote \#1](https://quotesby.net/Colin-Chapman/1/ "Permalink to quote 1")
3. > Beware of bugs in the above code; I have only proved it correct, not tried it.

[Donald Knuth](https://quotesby.net/Donald-Knuth)[Donald Knuth quote \#2](https://quotesby.net/Donald-Knuth/2/ "Permalink to quote 2")

```json
{
    "@context": "https://schema.org",
    "@type": "Quotation",
    "text": "Premature optimization is the root of all evil (or at least most of it) in programming.",
    "url": "https://quotesby.net/Donald-Knuth/1/",
    "spokenByCharacter": {
        "@type": "Person",
        "name": "Donald Knuth"
    }
}
{
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://quotesby.net/"
        },
        {
            "@type": "ListItem",
            "position": 2,
            "name": "Authors",
            "item": "https://quotesby.net/authors/"
        },
        {
            "@type": "ListItem",
            "position": 3,
            "name": "Donald Knuth",
            "item": "https://quotesby.net/Donald-Knuth"
        },
        {
            "@type": "ListItem",
            "position": 4,
            "name": "Quote #1",
            "item": "https://quotesby.net/Donald-Knuth/1/"
        }
    ]
}
```
