Mehdi Akiki

Posts tagged "python"

  • Published on

    Investigation · Part 12 of 20 · When the benchmark lies

    How Many Benchmark Runs Are Enough

    I ran the same sort in 300 fresh processes, in three sets of 100. Each set gave a median with a narrow bootstrap interval, and the intervals did not agree. More runs make the interval smaller, but only if the runs are independent, and on my laptop they were not.
  • Published on

    Investigation · Part 10 of 20 · When the benchmark lies

    Which Clock to Use When You Measure Time

    I measured eight of the clocks that clock_gettime can read, and on my laptop two of them disagreed by 43,257 ns after 20 seconds. I measured their resolution, their cost, which ones enter the kernel, and which clocks Rust and Python use.
  • Published on

    Investigation · Part 7 of 20 · What survives a crash

    Building a Tiny Crash Simulator From strace Output

    kill -9 could not tell a save with fsync from a save without it. So I wrote a small Python simulator that replays the strace output of a program and lists what a machine crash could leave at every moment. It found the zero-length file and the missing directory fsync.
  • Published on

    Investigation · Part 9 of 10 · Types under the hood

    Runtime Type Tags: What Dynamic Languages Keep That Static Ones Throw Away

    A Python integer with the value 1 takes 28 bytes, and a million of them cost 36 MB where Rust would use 4. I expected mixed arrays to be slow in V8 and they were not. The cost that did show up was object shape, and it arrives as a cliff at the fifth shape.
  • Published on

    Investigation · Part 4 of 20 · What survives a crash

    Why the Directory Needs fsync Too

    fsync of a new file does not promise that its name is on the disk. I measured directory fsync on ext4: half a microsecond after a file fsync, about 420 microseconds after a rename, and alone it made the name durable while the data stayed in RAM.