in reply to Calculating query time and rows returned in SQLite

I glanced at the SQLite docs, and I couldn't find anything.

Does it matter where it spent its time, as long as you know how long it took? Because you can get a quite high resolution timestamp out of Time::HiRes, and just calculate the differences.

#! perl -w use Time::HiRes qw(gettimeofday); use Time::HiRes qw(sleep); # for this demo only my @t = scalar gettimeofday; sleep 3.1415926; push @t, scalar gettimeofday; printf "Total time wasted: %.3f seconds\n", $t[-1]-$t[0];
The array @ serves two purposes: A) it stores the time measurements in a single variable (you can always use two scalars); and B) you can use it to add intermediate time markers, for more detailed reporting.

Replies are listed 'Best First'.
Re^2: Calculating query time and rows returned in SQLite
by stonecolddevin (Parson) on Nov 17, 2006 at 00:19 UTC

    This is more of a feature for the user to see and be like, "Oh, that's cool! This script is fast/slow!", so it doesn't really matter where it spends time, no. I'll try this out, and get back to you. Thanks bart!

    meh.