Hacker News new | ask | show | jobs
by jschwartzi 3625 days ago
gettimeofday() is totally inappropriate for benchmarking. Any time the system clock is being adjusted by NTP, for instance, your benchmark timing will be skewed.

They should be using the following API if they're going to use the system time to measure time differences:

clock_gettime(CLOCK_MONOTONIC, &timespec);

It's a really good clue that a timing function is inappropriate for benchmarking when the man page talks about time zones.

1 comments

While that may be true, the kind of errors you'd expect that to cause do not appear present in their results. It doesn't matter, here.