Mehdi Akiki

Posts tagged "benchmarking"

  • Published on

    Investigation · Part 11 of 20 · When the benchmark lies

    Measuring Something Faster Than the Clock

    Timed one call at a time, a small hash function and an empty loop both take 15 ns: the clock measures itself. With more calls per measurement, the same function costs 0.79 ns per call, or 3.02 ns when each call waits for the previous one.
  • 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 · When the benchmark lies

    The Benchmark Ran on an Efficiency Core

    On a laptop with two kinds of cores, I measured the same benchmark on a P-core and on an E-core, without taskset, and with two threads on one core. The E-core needed more cycles, not only a lower clock, and a busy sibling thread made a P-core as slow as an E-core.
  • Published on

    Investigation · Part 6 of 20 · When the benchmark lies

    My Laptop Changed Its CPU Speed During the Benchmark

    I measured the work of one loop and the clock of its core at the same time, for one minute. The clock moved between 3.3 and 4.2 GHz without any change in my program, and the work per cycle stayed the same in every phase. Here is the trace, and what I can do about it on a laptop.
  • Published on

    Investigation · Part 5 of 20 · When the benchmark lies

    JIT Warmup: Why a Function Gets Faster After Thousands of Calls

    A small Java function took 66 ns per call in the first batch and 3.6 ns after 185 batches. I matched the speed changes with the JIT compile log, compared C1 and C2, and looked at why the steady state was not one number.