I hadn't heard of the QueryPerformance commands before, I found your code IanM thanks, I'll keep it in mind for future reference.
However, the command I use the grab the time is the RDTSC command built into the processor and takes about 100 clock cycles when called from DBPro.
The Timer() command takes about 500, give or take a couple hundread, clock cycles, and the queryPerformanceCounter seems to take over 2000.
Benchmark without performanceCounter:
do
cls
set cursor 0,0
startTSCTimer
stopTSCTimer
time1# = getTSCTime()
print "Overhead: ";time1#
print
startTSCTimer
time# = getClockCount()
stopTSCTimer
time2# = getTSCTime()
print "TSC timer: ";time2#
startTSCTimer
time# = timer()
stopTSCTimer
time3# = getTSCTime()
print "DBPro Timer(): ";time3#
if scancode()<>0
wait 500
while scancode()=0
endwhile
wait 200
endif
loop
I agree that timer() should still be used for real-time timing, since it isn't slow and is going to be far more accurate to real time over greater timing spans - more and more processors come with speed step, which throws the clock to real-time calculations way off.
RDTSC is more useful for relative timing, like comparing sections of code for speed.