[ntp:questions] micro-optimization

Terje Mathisen "terje.mathisen at tmsw.no" at ntp.org
Wed Mar 11 14:07:49 UTC 2009

Martin Burnicki wrote:
> Here, 2 consequent QPC calls retrun a difference of ...
> 350..400 ns using TSCs on an Intel 3 GHz CPU 

That's horrible!

Since the RDTSC takes less than 10 ns on that cpu, the remaining 340-390 
ns is lost in the OS library interface. :-(

> 1.6..1.9 us using the PM timer on my AMD x64 4400+
> I think the difference is not relevant for NTP.

2 us vs 10 ns _can_ be significant, but only if we have at least 10k 
timing calls/second.



- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the questions mailing list