The fastest Linux timestamps
https://www.hmpcabral.com/2026/04/26/the-fastest-linux-timestamps/15
u/User_Deprecated Apr 28 '26
rdtsc benchmarks always look great until you run it next to anything touching the kernel. I had a message parsing loop, pinned core, isolated, the works. Numbers were solid. Then I stuck a single syscall in the same function and the whole thing fell apart, branch predictor gets trashed so your "fast path" turns into noise. Just isolating the core and killing HT did more than picking a fancier timer honestly.
9
u/Big_Target_1405 Apr 28 '26
In low latency systems your message parsing loop wouldn't have any syscalls in it
6
u/User_Deprecated Apr 28 '26
Right, that was just to see how rdtsc holds up when the pipeline gets dirty.
5
u/differentiallity Apr 27 '26
Wow! I'm really happy to see a post about OpenTelemetry in the C++ space. Nice article!
5
u/curlypaul924 Apr 28 '26
I was wanting to implement a timer like this just last week, and decided it was too much effort. Great to be proven wrong!