Mehdi Akiki

Writing archive

Everything published under Writing, newest first. Each entry is labelled as part of an investigation, an article or reference. Short engineering notes have their own archive.

  • Published on

    Investigation · Part 16 of 20 · From source to a running process

    Why Freeing Memory Does Not Shrink Your Process

    I freed 999,000 of one million small blocks and the process did not become one kilobyte smaller. malloc_stats, strace and malloc_trim show why: the heap can only shrink from its top, glibc keeps the free pages, and threads multiply the arenas. Rust behaves the same.
  • Published on
    A rustc self-profile records compiler activities and query events. First isolate the slow crate, then compare self time, invocation count, cache behaviour, and code generation under controlled builds.
  • Published on

    Investigation · Part 16 of 20 · What survives a crash

    Group Commit: How Databases Make fsync Cheaper

    With every writer syncing alone, my laptop made about 1,800 records per second durable, with 1 or 16 writers. With group commit, one fdatasync for all waiting records, 16 writers reached 15,822. A small delay before the sync helped 16 writers and hurt one, as PostgreSQL documents.
  • Published on

    Investigation · Part 16 of 20 · When the benchmark lies

    When the Working Set No Longer Fits in Cache

    One step of i = a[i] costs 1.4 ns when the array fits in L1 and 114 ns when it is 128 MiB, the same instruction. I measured the steps on a P-core and an E-core, a sequential read of the same arrays, and why I could not show the effect of huge pages.