On Wed, Feb 22, 2006 at 01:13:19AM +0200, Ulrich Sch??bel wrote:
> I don't think it's an interface problem. I'm using Tcl, more or less
> the 'natural' language for sqlite. Tcl doesn't have a garbage
> collection.

Tcl certainly *does* have garbage collection:

<http://wiki.tcl.tk/3096>
<http://wiki.tcl.tk/12144>

> The strangest thing is, I can reproduce this behaviour.
> I'm absolutely clueless. I stumbled over it by coincidence.
> Tried 1000 repetitions, was quite fast, so I tried 10000,
> which was even faster. This led me to the (obviously wrong)
> conclusion, that sqlite spends some time parsing the sql.
> Next I tried 100 repetitions, expecting a bit more than
> 76 microseconds. 310 microsecs didn't bother me really,
> I tried the 10 reps expecting even more. Then came the surprise:
> only 67 microsecs.
> 
> My first feeling was, something like a busy disk or so came
> in just when I tried the 100 reps. But the results were reproducible,
> deviating only by a few microseconds.

Try running the following script and see if there's an odd pattern to
the timing variations:

#!/usr/bin/env tclsh
package require sqlite3
if {[file exists aho.db]} {
  file delete aho.db
}
sqlite3 db aho.db
db eval {create table cust_persons ( first_name string, last_name string
)}
db eval {insert into cust_persons values ('Adrian','Ho')}
db eval {insert into cust_persons values ('Thunder','Lightning')}
foreach rounds {1 5 10 50 100 500 1000 5000 10000} {
  puts "t($rounds)=[time {db eval {select * from cust_persons where first_name 
= 'Adrian'}} $rounds]"
}
db close

- Adrian

Reply via email to