[ntp:questions] micro-optimization

David J Taylor david-taylor at blueyonder.neither-this-bit.nor-this.co.uk
Wed Mar 11 14:16:44 UTC 2009

Terje Mathisen" <"terje.mathisen at tmsw.no wrote:
> 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

On the Intel 6600 dual-core, 2.4GHz processor here, under XP, a RDTSC 
takes about 4.2ns, and a OS call to timeGetTime takes about 11.8ns.  At 
least, they do if my measurement program is working correctly....

Haven't checked QPC.


More information about the questions mailing list