Silly precision in a timing macros

Andreas Ericsson ae at op5.se
Fri Oct 29 02:45:17 CEST 2004


Jason Martin wrote:
> On Fri, Oct 29, 2004 at 09:51:40AM +1000, Stanley Hopcroft wrote:
> 
>>Do you really need this accuracy ?
>>Milliseconds are fine for me. Prob Seconds are also.
> 
> Seconds would be too course for measuring database row insertion
> times, perhaps tenths-of-a-milisecond would be enough.  I was
> raising the point only because I happened to have seen that data
> in my output, not because I particularly needed it.
> 

Database inserts are rarely done in less than 1 millisecond. The steps 
involved are;
parse command
evaluate values
hash values
insert in hash tables
copy to in-house memory
flush to disk

If you want exact timings, do 1000 or 10000 consecutive inserts and get 
an average. It will be much more accurate than timing a single insert 
anyway, and production applications shouldn't really bother with timing 
each insert. That's what testcases are for.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
This Newsletter Sponsored by: Macrovision 
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate 
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/




More information about the Developers mailing list