performance

  • Log lines that a machine can read

    A grep that needed three regular expressions and a sort. A log line written for a person to read at leisure is not a record you can query.

  • The cache that returned stale data for eleven days

    A price change that took eleven days to reach one page. Three caches, and only one of them was being cleared.

  • A laptop profile is a hypothesis, not a finding

    Four differences between a development machine and production can each invert the conclusion a profile suggests. The dataset difference is the one that inverts rather than scales: an…

  • SINTERCARD counts without materialising

    Counting the intersection of two large sets meant building the intersection first, which allocates a set you immediately discard. The LIMIT is the part that changes what is…

  • The N+1 that only appeared in the API serialiser

    A controller with eager loading and four hundred queries anyway, because the query count depends on which fields the client asked for.

  • ZRANGESTORE, and the sorted set you were rebuilding

    Taking a slice of a sorted set into a new key required reading it into the client and writing it back, which is O(n) over the network. The…

  • Vite in development and webpack in production is a real answer

    A 38-second dev server start on a machine with nothing else to do. Native ESM changes the feedback loop, and running two build tools has a specific cost.

  • realpath_cache_size, on a codebase with ten thousand files

    PHP caches resolved paths and the default size is small enough to thrash on a modern dependency tree. Every miss is a stat syscall, and a framework autoloading…

  • SplObjectStorage as a set, before WeakMap existed

    SplObjectStorage is a set of objects with O(1) membership, and it holds a strong reference to everything in it. It is genuinely the right tool for cycle detection…

  • useMemo is a hint and not a guarantee

    React may discard memoised values to free memory, so useMemo is a performance optimisation and never a correctness mechanism. The documentation is explicit that a future version may…