Pushing software engineering limits with “napkin math”
- Source
- newsletter.pragmaticengineer.com
- Publisher
- Gergely Orosz
- Author
- Gergely Orosz
- Date
Context
Simon Eskildsen uses rough calculations of data volume, bandwidth and storage latency to question software performance results. In this interview account, he explains that a large gap between an estimate and a measurement can reveal either an inefficient system or a mistaken understanding of how it works.
His database example exposed the second problem. He expected each transaction to require its own storage synchronization, but measured higher than that assumption allowed. Investigating revealed that MySQL groups transactions and synchronization work. The estimate was useful because its failure identified a mechanism he needed to understand.
- Napkin math means computing the theoretical floor first, the raw cost of moving those bytes or reading that data, then comparing it to what the system actually does. The gap tells you whether you are paying for physics or for waste.
- That gap is what created turbopuffer. Early ChatGPT windows were small, so retrieval was mandatory, and rough first-principles estimates showed existing search products cost far more than the underlying operations required.
- A competitive-programming lesson that generalizes: if you are writing code to handle a specific , you probably have the wrong solution. Two edge cases means two more you have not found; the simpler general solution absorbs them all.
- When you are fixated on an approach that is not working, delete the and start on a fresh sheet. The time already spent is smaller than the hole you keep digging.
- A cheap way to close a knowledge gap without a CS degree: note every term you did not recognize at work that day, and read up on each one that evening. Repeat for a year.
- throughput — How much model output a provider can generate over time, commonly measured in output tokens per second.
- Context and context window — Context is the information available for a generation; the context window is the capacity available to hold it.
- Edge case — An input at the boundary of what a program should handle, where the intended behavior is easy to leave undecided.
- Program — A set of instructions stored so that a computer can run it.
“But it should take 10 milliseconds if you do the napkin math.”
Simon Eskildsen
“For example, what does a gigabyte of memory cost? $2. What does a gigabyte of S3 cost? Two cents.”
Simon Eskildsen





