
Napkin Math
github.com/sirupsen/napkin-math- Category
- Developer Tools
- Rank
- No. 437Tools index
- Pricing
- Open Source
- Type
- TOOL
- Use case
- Research & Education
- Interfaces
- CLI · SDK
- Builder
- @sirupsen
- GitHub
- 5.8k stars
- Date
About
A collection of performance numbers, techniques, and benchmarks for quickly estimating system performance from first-principles. Helps developers make back-of-the-envelope calculations for system design decisions like storage costs, throughput expectations, and latency estimates.
What it does
Napkin Math pairs a compact reference table with runnable experiments. The table favors memorable orders of magnitude over precision, while the benchmark code measures memory access, compression, storage, hashing, system calls, sorting, serialization, and other machine-level work.
Why it's ranked here
Worth ten minutes because it connects rough mental models to executable measurements and openly labels uncertainty. The reference covers many common bottlenecks, while the repository shows how several figures are produced. Its honesty about inconsistent, incomplete, and workload-specific numbers makes it more useful than a deceptively precise cheat sheet.
What's good
The table translates latency and throughput into times for processing one mebibyte and one gibibyte, which makes comparisons immediately practical. It distinguishes sequential from random access, single-threaded from threaded memory work, and safe from non-safe hashing. The benchmark guidance also emphasizes optimized builds, controlled host settings, and workload context.
Tradeoffs
Several table cells remain unknown, and some latency and throughput figures intentionally do not align. The author describes the numbers as rough and acknowledges benchmark inefficiencies. Some newer serialization and compression measurements do not feed the generic table. Reproducing active runs also requires privileged Linux tuning, while cloud storage experiments require provider credentials.
How to use it well
Use it when sketching an architecture, checking whether an estimate is plausible, or building intuition through short practice problems. Treat each number as a starting assumption, then run relevant experiments on representative hardware and workloads. It suits engineers making early system decisions, but it does not replace production load testing, provider measurements, or precise capacity planning.
Technical notes+
Cargo.toml defines a Rust 2018 Cargo package and a custom Criterion benchmark target. In the supplied source, benches/napkin_math.rs registers only the groups implemented through benches/benchmarks/memory_read.rs and benches/benchmarks/compressed_memory_read.rs, although README.md describes a broader active suite. src/main.rs contains the older ad hoc CLI harness. run applies Linux host tuning with sudo, invokes Cargo benchmarks under perf stat, and restores some settings afterward. Additional experiments appear in go/main.go, go/main_test.go, and Ruby scripts under newsletter/.
Observed
- License
- MIT License
- Primary language
- Rust
- Packaging
- Cargo package with a declared custom Criterion benchmark target
- Interfaces
- Command-line benchmark harness and Criterion benchmark suite
- Platform support
- The active benchmark wrapper targets Linux host controls and uses sudo
- Additional languages
- Go and Ruby experiment code is included
- Testing structure
- A Go benchmark test file is present
Read from README.md, Cargo.toml, src/main.rs, go/main.go, go/main_test.go, benches/napkin_math.rs, newsletter/14-syncing/time.rb, newsletter/14-syncing/check.rb, newsletter/14-syncing/populate.rb, newsletter/20-compound-vs-combining-indexes/test.rb, benches/benchmarks/mod.rs, benches/benchmarks/memory_read.rs, benches/benchmarks/compressed_memory_read.rs, run, LICENSE.
What it can do
Estimate system storage costs
Data volume and storage requirements → Cost calculations and estimates
Calculate system throughput expectations
System specifications and performance parameters → Throughput estimates and benchmarks
Estimate system latency
Network and processing parameters → Latency predictions and timing estimates
Perform back-of-the-envelope calculations for system design
System requirements and constraints → Quick performance estimates and design recommendations
Provide performance benchmarks
System components or operations → Current performance numbers and metrics
Generate practice problems for system estimation
User request or newsletter subscription → Performance estimation exercises and scenarios
Intel on Napkin Math
Tags
Tech Stack
Media
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.