quantfold

Ring buffers are underrated

A fixed-size circular queue solves most "I need a small log" problems without an allocator in the hot path. Notes on head/tail arithmetic, power-of-two masks, and the one off-by-one everyone hits.

Summing floats without losing your mind

Naive accumulation drifts. Kahan summation fixes most of it for a few extra instructions. When pairwise summation is the better trade, with numbers.

What SQLite's WAL mode actually buys you

Readers stop blocking writers, checkpoints become the thing to tune, and the two settings that matter for a single-process service.

Tail latency is a distribution, not a number

Why p99 lies when traffic is bursty, and a small histogram type that replaces averages in every service I run.