sirupsen/napkin-math
sirupsen/napkin-math được TopGit xếp vào nhóm dự án mã nguồn mở, với 5.8k sao trên GitHub, viết chủ yếu bằng Rust. Techniques and numbers for estimating system's performance from first-principles
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Snapshot
Cộng tác viên hàng đầu
Xem cộng tác viên hàng đầu
Napkin Math
The goal of this project is to collect software, numbers, and techniques to quickly estimate the expected performance of systems from first-principles. For example, how quickly can you read 1 GB of memory? By composing these resources you should be able to answer interesting questions like: how much storage cost should you expect to pay for logging for an application with 100,000 RPS?
The best introduction to this skill is through my talk at SRECON.
The best way to practise napkin math in the grand domain of computers is to work on your own problems. The second-best is to subscribe to this newsletter where you'll get a problem every few weeks to practise on. It should only take you a few minutes to solve each one as your facility with these techniques improve.
The archive of problems to practise with are here. The solution will be in the following newsletter.
Numbers
Below are numbers rounded for memorization, not faux precision. Last measured in October-November 2026, averaged over GCP C4 and AWS m8i (x86) and m8g (Graviton4), 48 vCPU each, and their local-SSD variants; network disks on Hyperdisk, EBS and pd-standard, HDDs on an AWS d3. Blob storage was measured in March 2026, and the GPU rows are NVIDIA's specs. Most cells are one run per machine, so trust the order of magnitude more than the digit. See BENCHMARKING.md to run them yourself.
| Operation | Latency | Throughput |
|---|---|---|
| GPU Memory Sequential Read (B200) | 7 TiB/s | |
| GPU ↔ GPU Transfer, NVLink (B200) | 800 GiB/s | |
| CPU Decode Bitpacked Integers (512 B), all cores | 50 ns | 500 GiB/s |
| L1 Cache Read (64 B), 1 thread | 2 ns | 200 GiB/s |
| Memory Sequential Read (64 B), all cores | 20 ns | 200 GiB/s |
| Memory Sequential Write (64 B), all cores | 30 ns | 200 GiB/s |
| Memory Random Read (64 B), all cores | 150 ns | 200 GiB/s |
| Memory Random Write (64 B), all cores | 150 ns | 200 GiB/s |
| L2 Cache Read (64 B), 1 thread | 5 ns | 150 GiB/s |
| Memory Sequential Read (64 B), other socket, all cores‡ | 100 ns | 60 GiB/s |
| CPU Decode Bitpacked Integers (512 B), 1 thread | 10 ns | 50 GiB/s |
| GPU ↔ GPU Network, RDMA (400 Gbit/s) | 5 μs | 50 GiB/s |
| GPU ↔ CPU Transfer, PCIe (B200) | 10 μs | 50 GiB/s |
| L3 Cache Read (64 B), 1 thread | 50 ns | 40 GiB/s |
| Memory Sequential Read (64 B), 1 thread | 5 ns | 30 GiB/s |
| Memory Sequential Write (64 B), 1 thread | 10 ns | 30 GiB/s |
| Memory Random Write (64 B), 1 thread | 150 ns | 30 GiB/s |
| CPU Hash, not crypto-safe (xxh3, 64 B), 1 thread | 5 ns | 20 GiB/s |
| Memory Random Read (64 B), 1 thread | 150 ns | 20 GiB/s |
| Memory Sequential Read (64 B), other socket, 1 thread‡ | 5 ns | 15 GiB/s |
| Memory Random Read (64 B), other socket, 1 thread‡ | 250 ns | 15 GiB/s |
| CPU Encode Bitpacked Integers (512 B), 1 thread | 50 ns | 10 GiB/s |
| CPU Encrypt / Decrypt (AES-256-GCM, 64 B), 1 thread | 50 ns | 10 GiB/s |
| SSD Sequential Read (8 KiB), 1 thread | 150 μs | 5 GiB/s |
| SSD Random Read (8 KiB), 1 thread | 200 μs | 5 GiB/s |
| SSD Random Write (8 KiB), 1 thread | 40 μs | 3 GiB/s |
| SSD Sequential Durable Write (8 KiB), 1 thread† | 40 μs | 3 GiB/s |
| SSD Sequential Write (8 KiB), 1 thread | 40 μs | 3 GiB/s |
| Network Same-Zone (32 KiB) | 250 μs | 3 GiB/s |
| Network Cross-Zone (64 KiB) | 1 ms | 3 GiB/s |
| Blob Storage, Zonal Read (128 KiB) | 50 ms | 3 GiB/s |
| Network Cross-Region, Same-Continent (1 MiB)* | 50 ms | 3 GiB/s |
| Blob Storage, Regional Read (128 KiB) | 100 ms | 3 GiB/s |
| Network Cross-Region, Cross-Atlantic (1 MiB)* | 100 ms | 3 GiB/s |
| Network Cross-Region, US ↔ Singapore (1 MiB)* | 200 ms | 3 GiB/s |
| CPU Hash, crypto-safe (SHA-256, 64 B), 1 thread | 100 ns | 2 GiB/s |
| CPU Decompress (lz4, zstd -1, 4 KiB), 1 thread | 3 μs | 2 GiB/s |
| CPU Decode Parquet (dictionary + zstd, 4 KiB page), 1 thread | 10 μs | 2 GiB/s |
| Blob Storage, Regional Write (128 KiB) | 200 ms | 2 GiB/s |
| Blob Storage, Zonal Write (128 KiB) | 200 ms | 2 GiB/s |
| CPU Serialize (JSON, Protobuf, 256 B), 1 thread | 200 ns | 1 GiB/s |
| Network Disk, Regional Random Read (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Regional Sequential Read (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Zonal Random Read (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Zonal Random Write (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Zonal Sequential Durable Write (8 KiB), 1 thread† | 1 ms | 1 GiB/s |
| Network Disk, Zonal Sequential Read (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Zonal Sequential Write (8 KiB), 1 thread | 1 ms | 1 GiB/s |
| Network Disk, Regional Random Write (8 KiB), 1 thread | 2 ms | 1 GiB/s |
| Network Disk, Regional Sequential Durable Write (8 KiB), 1 thread† | 2 ms | 1 GiB/s |
| Network Disk, Regional Sequential Write (8 KiB), 1 thread | 2 ms | 1 GiB/s |
| CPU Deserialize (JSON, Protobuf, 256 B), 1 thread | 500 ns | 500 MiB/s |
| CPU Compress (lz4, zstd -1, 4 KiB), 1 thread | 10 μs | 500 MiB/s |
| CPU Sort (64-bit integers, 4 KiB), 1 thread | 3 μs | 300 MiB/s |
| CPU Encode Parquet (dictionary + zstd, 4 KiB page), 1 thread | 50 μs | 300 MiB/s |
| Network Disk, Zonal, HDD Random Write (8 KiB), 1 thread | 600 μs | 250 MiB/s |
| Network Disk, Zonal, HDD Sequential Write (8 KiB), 1 thread | 600 μs | 250 MiB/s |
| Network Disk, Regional, HDD Sequential Read (8 KiB), 1 thread | 1 ms | 250 MiB/s |
| Network Disk, Zonal, HDD Sequential Read (8 KiB), 1 thread | 1 ms | 250 MiB/s |
| Network Disk, Regional, HDD Random Read (256 KiB), 1 thread | 100 ms | 250 MiB/s |
| Network Disk, Zonal, HDD Random Read (256 KiB), 1 thread | 100 ms | 250 MiB/s |
| HDD Sequential Read (8 KiB), 1 thread | 100 μs | 200 MiB/s |
| HDD Sequential Write (8 KiB), 1 thread | 100 μs | 200 MiB/s |
| Network Disk, Zonal, HDD Sequential Durable Write (8 KiB), 1 thread† | 1 ms | 200 MiB/s |
| Network Disk, Regional, HDD Random Write (8 KiB), 1 thread | 1.5 ms | 200 MiB/s |
| Network Disk, Regional, HDD Sequential Durable Write (8 KiB), 1 thread† | 1.5 ms | 200 MiB/s |
| Network Disk, Regional, HDD Sequential Write (8 KiB), 1 thread | 1.5 ms | 200 MiB/s |
| HDD Random Write (256 KiB), 1 thread | 15 ms | 100 MiB/s |
| HDD Random Read (256 KiB), 1 thread | 25 ms | 100 MiB/s |
| Blob Storage, Regional Read (128 KiB), 1 connection | 100 ms | 100 MiB/s |
| HDD Sequential Durable Write (8 KiB), 1 thread† | 30 ms | 50 MiB/s |
| CPU Atomic Increment | 5 ns | |
| CPU Mutex Lock + Unlock | 10 ns | |
| CPU Atomic Increment, contended | 30 ns | |
| CPU System Call | 100 ns | |
| CPU Mutex Lock + Unlock, contended | 200 ns | |
| CPU Context Switch | 1 μs | |
| CPU Cross-core Wake-up | 2 μs | |
| CPU TCP Connect (+1 RTT) | 10 μs | |
| Cache Get (Memcached, Redis) (+1 RTT) | 25 μs | |
| CPU Thread Spawn | 30 μs | |
| Proxy Request (HAProxy, Nginx) (+1 RTT) | 30 μs | |
| Database Query, primary key (MySQL, Postgres) (+1 RTT) | 40 μs | |
| CPU Process Spawn | 300 μs | |
| CPU TLS 1.3 Handshake (+1 RTT) | 300 μs | |
| Blob Storage, Regional Conditional Write (128 KiB) | 100 ms | |
| Blob Storage, Zonal Conditional Write (128 KiB) | 100 ms | |
| Blob Storage, Zonal List (1000 keys) | 100 ms | |
| Blob Storage, Regional List (1000 keys) | 150 ms |
† pwrite + fdatasync into a preallocated file; one thread keeps 32 in flight with io_uring, and the latency is one at a time. Cloud SSDs and most network disks have no write cache to flush (pd-standard and Azure Premium SSD flush in 30-80 μs), so a durable write costs a write. HDDs flush theirs (~1 ms, 30 ms at p99), which 32 in flight don't speed up. Appending instead costs ~150 μs on SSD and 1-4 ms on network disks, because the file system journals the new size. A local SSD is lost with its VM; a network disk isn't.
‡ Only the largest shapes span two sockets. Reading the other socket's memory costs ~2x the latency, and all cores share the ~60 GiB/s link (Graviton4). Keep memory on the socket that reads it: Linux allocates on the node of the thread that first touches a page. Intel's largest VMs also split one socket into a NUMA node per die; another die costs 1.2x the latency and 0.7x one thread's bandwidth, but all cores lose only ~10%.
* With Linux's default TCP buffers, one connection moves ~3 MiB per round trip:
30 MiB/s at 100 ms. Raise net.core.rmem_max, net.core.wmem_max and the
maxima in net.ipv4.tcp_rmem / tcp_wmem to 256 MiB on both ends and it moves
30-60 MiB: 300-600 MiB/s at 100 ms. Throughput here is with raised buffers and 32
connections, which fill the VM's ~30 Gbit/s at any distance.
Every row is one latency and one throughput. The latency is one request at a time, each waiting for the last, at the size in parentheses: a natural unit, a cache line or a block, that's as fast as anything smaller. HDD random I/O uses 256 KiB, because the seek dwarfs the transfer. Disk, network, blob storage and service latencies are p99; CPU and memory rows time a tight loop, which has only a mean. Throughput is the most we got at any size and any number of requests in flight (BENCHMARKING.md has the smallest size that reaches it), on a 48 vCPU VM and its disks: local NVMe SSDs striped together, EBS gp3 at 16k IOPS / 1000 MiB/s and Hyperdisk Balanced at 80k IOPS / 1600 MiB/s, 2 TB pd-standard for network HDDs. Large random requests are nearly sequential, so random and sequential throughput end up close. Small independent ones overlap instead: one thread does ~60M random 64 B memory reads a second (4 GiB/s), 10x what 150 ns each implies, and all cores ~1.5 billion (100 GiB/s). Regional disks copy every write to a second zone, which adds ~1 ms to every write.
Sort is the exception to max throughput: it runs at 1.3 GiB/s on 4 KiB and 300 MiB/s on 1 GiB, and 300 MiB/s is the number you need for anything big. Hashing is the other: xxh3 does 70 GiB/s on data already in cache, but 20 GiB/s on 1 GiB from memory. CPU and memory rows marked 1 thread scale with cores until memory bandwidth runs out (on x86 a vCPU is half a core). x86 memory writes need non-temporal stores to get there; on one thread, a plain memset first reads every line it overwrites and gets half. Memory latency uses 2 MiB huge pages; 4 KiB pages add ~50%, and 1 GiB pages save ~10%. Sequential reads take 5 ns because the prefetchers got there first, and the all-cores rows are with every core doing the same. A write only waits if something makes it: a plain store retires into the store buffer in ~1 ns, so the write latency is an atomic add, which has to own the line first. The +1 RTT rows leave out the round trip, so add the network's; a proxy also adds one to its backend.
One TCP flow gets the VM's bandwidth on GCP but 5 Gbit/s (600 MiB/s) on AWS outside a placement group, and 3 MiB / RTT across regions with default buffers (*). Blob Storage latency is from the same region; Zonal is S3 Express One Zone and GCS Rapid. Conditional writes are compare-and-swap on one object, one at a time; regional GCS also allows only ~1 write per second to the same object. Region-to-region latencies: cloudping.
Cost Numbers
Approximate numbers that should be consistent between Cloud providers.
| What | Amount | $ / Month | 1-year $ / Month | Spot $ / Month |
|---|---|---|---|---|
| CPU | 1 vCPU | $30 | $20 | $15 |
| GPU (B200) | 1 | $10000 | $8000 | $7000 |
| Memory | 1 GB | $2.5 | $2 | $1 |
| Storage | ||||
| ├ Warehouse Storage | 1 GB | $0.02 | ||
| ├ Blob Storage, Regional | 1 GB | $0.02 | ||
| ├ Blob Storage, Zonal | 1 GB | $0.1 | ||
| ├ Network Disk, Zonal, HDD | 1 GB | $0.04 | ||
| ├ SSD | 1 GB | $0.15 | $0.1 | $0.08 |
| ├ SSD, storage-optimized | 1 GB | $0.05 | $0.01 | |
| ├ HDD | 1 GB | $0.01 | $0.004 | |
| ├ Network Disk, Regional, HDD | 1 GB | $0.08 | ||
| ├ Network Disk, Zonal | 1 GB | $0.1 | ||
| ├ Network Disk, Regional | 1 GB | $0.2 | ||
| ├ Network Disk, Zonal IOPS‖ | 1 IOPS | $0.005 | ||
| ├ Network Disk, Regional IOPS‖ | 1 IOPS | $0.01 | ||
| ├ Network Disk, Zonal Throughput‖ | 1 MiB/s | $0.04 | ||
| ├ Network Disk, Regional Throughput‖ | 1 MiB/s | $0.08 | ||
| Network | ||||
| ├ Same-Zone | 1 GB | $0 | ||
| ├ Blob Storage, Same-Region | 1 GB | $0 | ||
| ├ Ingress | 1 GB | $0 | ||
| ├ L4 Load Balancer | 1 GB | $0.005 | ||
| ├ Cross-Zone | 1 GB | $0.01 | ||
| ├ Cross-Region | 1 GB | $0.02 | ||
| ├ Internet Egress †† | 1 GB | $0.1 | ||
| CDN Egress | 1 GB | $0.08 | $0.06 | |
| CDN Fill ¶ | 1 GB | $0.01 | ||
| Logs/Traces ♣ | 1 GB | $0.5 | ||
| Metrics (series) | 1000 | $20 | ||
| KMS Keys | 1 | $1 |
‖ Provisioned on SSD network disks, above the first 3,000 IOPS and ~125 MiB/s, which are free. Network HDDs get theirs with their size.
CDN Egress for 1 year is CloudFront's Security Savings Bundle.
†† This refers to network leaving your cloud provider, e.g. sending data to S3 from GCP or egress network for sending HTML from AWS to a client.
¶ CDNs also charge ~$1 per 1M requests, cache hits included.
♣ Datadog charges $0.1/GB ingested plus ~$1.5 per 1M indexed events for 7d retention.
Furthermore, for blob storage (S3/GCS/R2/...), you're charged per read/write operation (fewer, large files is cheaper):
| Regional, 1M | Zonal, 1M | |
|---|---|---|
| Reads | $0.4 | $0.1 |
| Writes, Lists | $5 | $1 |
| KMS Encryption | $3 | $3 |
Zonal buckets also charge $0.003 per GB written and $0.0006 per GB read.
Instance shapes are the same few ratios on every cloud, here per vCPU averaged over AWS and GCP (HDD and B200s are AWS's; GCP has no local HDD) at list price in their cheapest US region: on-demand, a 1-year Compute Savings Plan or committed use discount with no upfront, and spot, the 75th percentile across every region of both clouds. One B200 comes with 25 vCPU. Most cost a vCPU plus its memory and disks at the unit prices above; the largest memory shapes and B200s cost more. The HDD shape's drives are 14 TB, so at ~100 random reads/s each it does ~7 reads/s per TB:
| Shape | vCPU | Memory (GiB) | VRAM (GB) | SSD (GB) | HDD (GB) | Network (GB/s) | $ / mo / vCPU | 1-year | Spot | Max (vCPU) |
|---|---|---|---|---|---|---|---|---|---|---|
| CPU | 1 | 2 | 0.07 | $35 | $20 | $15 | 300 | |||
| General | 1 | 4 | 0.07 | $40 | $25 | $20 | 300 | |||
| General, SSD | 1 | 4 | 60 | 0.07 | $50 | $30 | $25 | 300 | ||
| Memory | 1 | 8 | 0.07 | $50 | $35 | $25 | 300 | |||
| Memory, SSD | 1 | 8 | 60 | 0.07 | $60 | $40 | $30 | 300 | ||
| Memory, High | 1 | 16 | 0.06 | $70 | $45 | $15 | 200 | |||
| Memory, High, SSD | 1 | 16 | 30 | 0.1 | $80 | $45 | $20 | 128 | ||
| Memory, Ultra, SSD | 1 | 32 | 30 | 0.1 | $150 | $110 | $30 | 128 | ||
| SSD | 1 | 8 | 250 | 0.07 | $80 | $50 | $25 | 200 | ||
| SSD, High | 1 | 8 | 600 | 0.15 | $100 | $70 | $30 | 200 | ||
| HDD | 1 | 4 | 7000 | 0.2 | $100 | $70 | $25 | 48 | ||
| GPU (B200) | 1 | 14 | 7 | 100 | 2 | $450 | $350 | $300 | 200 |
Reading 1 TiB costs the compute's time at the row's throughput (1 TiB / throughput x the shape's $ / month / 2.6M seconds, from the tables above), plus the transfer and request fees above. The compute is 48 vCPU of General for network, 48 vCPU of General, SSD for local SSDs, one vCPU of General for the 1-thread memory row, 2 vCPU of HDD for one 14 TB drive, and a B200 for the GPU row. Local disks pay their rent in those shapes. Network disks use just enough General to reach them, at ~40 MB/s per vCPU, plus the rent while it reads: 1 TiB of SSD with 16k IOPS and 1000 MiB/s, or 2 TB of HDD. Blob rent while reading rounds to nothing:
| What | $ / TiB read | 1-year | Spot |
|---|---|---|---|
| Memory Sequential Read, 1 thread | $0.0005 | $0.0003 | $0.0003 |
| GPU Memory Sequential Read (B200) | $0.0005 | $0.0004 | $0.0004 |
| Memory Sequential Read, all cores | $0.004 | $0.002 | $0.002 |
| Memory Random Read (64 B), all cores | $0.004 | $0.002 | $0.002 |
| SSD Sequential Read (8 KiB) | $0.2 | $0.1 | $0.09 |
| SSD Random Read (8 KiB) | $0.2 | $0.1 | $0.09 |
| Network Same-Zone (32 KiB) | $0.2 | $0.2 | $0.1 |
| Blob Storage, Regional Read (8 MiB) | $0.3 | $0.2 | $0.2 |
| HDD Sequential Read (8 KiB) | $0.4 | $0.3 | $0.1 |
| Network Disk, Zonal Sequential Read (8 KiB) | $0.5 | $0.3 | $0.3 |
| Network Disk, Zonal Random Read (8 KiB) | $0.5 | $0.3 | $0.3 |
| Network Disk, Zonal, HDD Sequential Read (8 KiB) | $0.5 | $0.4 | $0.3 |
| Network Disk, Zonal, HDD Random Read (256 KiB) | $0.5 | $0.4 | $0.3 |
| Network Disk, Regional Sequential Read (8 KiB) | $0.6 | $0.4 | $0.4 |
| Network Disk, Regional Random Read (8 KiB) | $0.6 | $0.4 | $0.4 |
| Network Disk, Regional, HDD Sequential Read (8 KiB) | $0.7 | $0.5 | $0.5 |
| Network Disk, Regional, HDD Random Read (256 KiB) | $0.7 | $0.5 | $0.5 |
| HDD Random Read (256 KiB) | $0.8 | $0.6 | $0.2 |
| Blob Storage, Zonal Read (8 MiB)§ | $0.9 | $0.8 | $0.8 |
| Blob Storage, Zonal Read (128 KiB)§ | $2 | $2 | $2 |
| Blob Storage, Regional Read (128 KiB) | $4 | $4 | $3 |
| Warehouse Query | $5 | $5 | $5 |
| Network Cross-Zone (64 KiB) | $10 | $10 | $10 |
| Network Cross-Region | $20 | $20 | $20 |
| Network Internet Egress | $100 | $100 | $100 |
§ Zonal GETs cost 4x less, but every byte read costs $0.6/TiB, so zonal is cheaper below ~500 KiB per request and regional above.
Compression Ratios
Measured with cpu_compress; each range spans lz4 to zstd -19. Note
that compression speeds (but generally not ratios) vary by orders of magnitude
depending on the algorithm and the level of compression (which trades speed for
compression).
I typically ballpark that another x in compression ratio decreases performance by 10x. E.g. on the Silesia corpus, lz4 gets 2x at ~500 MiB/s, zstd -9 3.5x at ~50 MiB/s and zstd -19 4x at ~3 MiB/s.
| What | Compression Ratio |
|---|---|
| HTML | 4-8x |
| English | 2-4x |
| Source Code | 3-10x |
| Executables | 2-5x |
| RPC (JSON) | 5-13x |
| Logs | 6-30x |
| Encrypted / compressed | 1x |
Structured data, against its in-memory size (8 bytes per float64, the type's
width per integer, the bytes plus a 4-byte offset per string), measured on real
datasets with compression_ratio:
| What | Encoding | Ratio or size |
|---|---|---|
| Columnar table | Parquet dictionary + RLE + zstd | 10x |
| Floats | ALP | 4x |
| Integers | FOR / delta + bitpacking | 2-4x |
| Strings | FSST | 2x |
| Low-cardinality column | Dictionary | log2(distinct) bits / value |
| Sorted or repeating column | RLE | 3 bytes / run |
ALP gets the same ratio as zstd on floats and decodes at ~10 GiB/s on one core. Floats that use the full mantissa (coordinates, model weights) barely compress at all. Bitpacked integers take log2 of each 1024-value range in bits and decode at ~15 GiB/s into a whole column, ~50 GiB/s a block at a time into cache; sorted or low-cardinality columns need RLE or a dictionary first. FSST decodes at ~2 GiB/s and keeps every string decodable on its own, where zstd over a whole column gets 3-10x. Dictionary and RLE columns also pay for the dictionary itself (each distinct value once); the smaller of the two rules predicts Parquet's dictionary + RLE size of whole tables within 10%.
Search indexes, as a fraction of the text they index, with Tantivy's posting lists (n-grams per source file for code, per ~16 KiB otherwise). Bloom filters are per 1 MiB block; a query still decompresses and scans every block that matches:
| What | Prose | Code | Logs | Relational Columns |
|---|---|---|---|---|
| Text, zstd -3 (1 MiB blocks) | 0.35 | 0.2 | 0.08 | 0.3 |
| Inverted index | 0.25 | 0.1 | 0.15 | 0.3 |
| Inverted index + positions | 0.4 | 0.25 | 0.3 | 0.4 |
| Trigram index (regex) | 0.1 | 0.1 | 0.05 | 0.1 |
| Fourgram index (regex) | 0.3 | 0.25 | 0.1 | 0.25 |
| Sparse n-gram index (regex) | 0.6 | 0.5 | 0.15 | 0.45 |
| Trigram bloom filter, 1% FP (1 MiB) | 0.015 | 0.02 | 0.005 | 0.015 |
Techniques
- Don't overcomplicate. If you are basing your calculation on more than 6 assumptions, you're likely making it harder than it should be.
- Keep the units. They're good checksumming. Wolframalpha has terrific support if you need a hand in converting e.g. KiB to TiB.
- Calculate with exponents. A lot of back-of-the-envelope calculations are
done with just coefficients and exponents, e.g.
c * 10^e. Your goal is to get within an order of magnitude right--that's juste.cmatters a lot less. Only worrying about single-digit coefficients and exponents makes it much easier on a napkin (not to speak of all the zeros you avoid writing). - Perform Fermi decomposition. Write down things you can guess at until you can start to hint at an answer. When you want to know the cost of storage for logging, you're going to want to know how big a log line is, how many of those you have per second, what that costs, and so on.
Resources
- Systems Performance (book). Fantastic book about analyzing system performance, finding bottlenecks, and understanding operating systems.
- Files are hard
Repo liên quan
Master programming by recreating your favorite technologies from scratch.
A curated meta-list of curated lists organized by technology domain. The repository acts as a directory pointing to hundreds of specialized awesome lists covering programming languages, platforms, frameworks, and tooling. All content is community-contributed under the CC0 public domain dedication.
Public APIs is a community-curated GitHub repository listing free, publicly accessible APIs across a wide range of categories, with auth type, HTTPS, and CORS noted for each entry. It's a browsable reference, not a library to install.
REA is an MCP server and CLI that gives AI coding agents the ability to reverse engineer binaries, JavaScript apps, .NET assemblies, and websites. It hooks into Hopper, Ghidra, or IDA Pro for native binary work, or runs static JavaScript analysis with just Node.js. Every investigation returns an Evidence bundle that includes what was found, what was not, and the reasoning path. Setup registers REA with supported agents and walks you through connecting an analysis engine. The CLI also works standalone for terminal-first workflows.
Trả lời nhanh
Đọc thêm về sirupsen/napkin-math ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/sirupsen/napkin-math là nguồn chính thức.
sirupsen/napkin-math có bao nhiêu sao?
sirupsen/napkin-math có 5.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/sirupsen/napkin-math. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
sirupsen/napkin-math có phải mã nguồn mở không?
Có — sirupsen/napkin-math phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/sirupsen/napkin-math.
sirupsen/napkin-math còn đang phát triển không?
Commit gần nhất trên sirupsen/napkin-math là 6 ngày trước (theo timestamp GitHub). Repo có 241 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
sirupsen/napkin-math là gì?
sirupsen/napkin-math (sirupsen/napkin-math) là dự án Rust trên GitHub. Theo mô tả gốc: Techniques and numbers for estimating system's performance from first-principles
Đọc đầy đủ README ở tab phía trên.
Chưa chắc napkin-math có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về napkin-math.