/ Check-in [1a4d8024]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the output of the speed tests. (CVS 3785)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1a4d8024b06488f17831b5d3d47e41c5f1134800
User & Date: drh 2007-03-31 22:34:16
Context
2007-04-01
01:57
Fix typos in the amalgamation builder script. (CVS 3786) check-in: a5070a2d user: drh tags: trunk
2007-03-31
22:34
Improvements to the output of the speed tests. (CVS 3785) check-in: 1a4d8024 user: drh tags: trunk
22:33
Remove unreachable code from util.c. (CVS 3784) check-in: 82b7a6f0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/speed1.test.

7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
...
279
280
281
282
283
284
285

286
287
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is measuring executing speed.
#
# $Id: speed1.test,v 1.4 2007/03/26 16:30:16 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Set a uniform random seed
expr srand(0)

set sqlout [open speed1.txt w]
proc tracesql {sql} {
  puts $::sqlout $sql\;
................................................................................
speed_trial speed1-random-del2 20000 row {
  DELETE FROM t1 WHERE rowid IN
    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
}
do_test speed1-1.2 {
  db one {SELECT count(*) FROM t1}
} 10000


finish_test







|




>







 







>


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
280
281
282
283
284
285
286
287
288
289
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is measuring executing speed.
#
# $Id: speed1.test,v 1.5 2007/03/31 22:34:16 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
speed_trial_init speed1

# Set a uniform random seed
expr srand(0)

set sqlout [open speed1.txt w]
proc tracesql {sql} {
  puts $::sqlout $sql\;
................................................................................
speed_trial speed1-random-del2 20000 row {
  DELETE FROM t1 WHERE rowid IN
    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
}
do_test speed1-1.2 {
  db one {SELECT count(*) FROM t1}
} 10000
speed_trial_summary speed1

finish_test

Changes to test/speed2.test.

7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
...
328
329
330
331
332
333
334

335

336
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is measuring executing speed.
#
# $Id: speed2.test,v 1.5 2007/03/31 15:02:50 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Set a uniform random seed
expr srand(0)

set sqlout [open speed2.txt w]
proc tracesql {sql} {
  puts $::sqlout $sql\;
................................................................................
speed_trial speed2-random-del2 20000 row {
  DELETE FROM t1 WHERE rowid IN
    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
}
do_test speed2-1.2 {
  db one {SELECT count(*) FROM t1}
} 10000



finish_test







|




>







 







>

>

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
329
330
331
332
333
334
335
336
337
338
339
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is measuring executing speed.
#
# $Id: speed2.test,v 1.6 2007/03/31 22:34:16 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
speed_trial_init speed2

# Set a uniform random seed
expr srand(0)

set sqlout [open speed2.txt w]
proc tracesql {sql} {
  puts $::sqlout $sql\;
................................................................................
speed_trial speed2-random-del2 20000 row {
  DELETE FROM t1 WHERE rowid IN
    (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
}
do_test speed2-1.2 {
  db one {SELECT count(*) FROM t1}
} 10000
speed_trial_summary speed2


finish_test

Changes to test/tester.tcl.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135


136








137
138
139
140
141
142
143
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.76 2007/03/25 19:08:47 drh Exp $

# Make sure tclsqlite3 was compiled correctly.  Abort now with an
# error message if not.
#
if {[sqlite3 -tcl-uses-utf]} {
  if {"\u1234"=="u1234"} {
    puts stderr "***** BUILD PROBLEM *****"
................................................................................
  }
}

# Run an SQL script.  
# Return the number of microseconds per statement.
#
proc speed_trial {name numstmt units sql} {
  puts -nonewline [format {%-20.20s } $name...]
  flush stdout
  set speed [time {sqlite3_exec_nr db $sql}]
  set tm [lindex $speed 0]
  set per [expr {$tm/(1.0*$numstmt)}]
  set rate [expr {1000000.0*$numstmt/$tm}]
  set u1 us/$units
  set u2 $units/s


  puts [format {%20.3f %-7s %20.5f %s} $per $u1 $rate $u2]








}

# The procedure uses the special "sqlite_malloc_stat" command
# (which is only available if SQLite is compiled with -DSQLITE_DEBUG=1)
# to see how many malloc()s have not been free()ed.  The number
# of surplus malloc()s is stored in the global variable $::Leak.
# If the value in $::Leak grows, it may mean there is a memory leak







|







 







|



<

<

>
>
|
>
>
>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
121
122
123
124
125
126
127
128
129
130
131

132

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.77 2007/03/31 22:34:16 drh Exp $

# Make sure tclsqlite3 was compiled correctly.  Abort now with an
# error message if not.
#
if {[sqlite3 -tcl-uses-utf]} {
  if {"\u1234"=="u1234"} {
    puts stderr "***** BUILD PROBLEM *****"
................................................................................
  }
}

# Run an SQL script.  
# Return the number of microseconds per statement.
#
proc speed_trial {name numstmt units sql} {
  puts -nonewline [format {%-21.21s } $name...]
  flush stdout
  set speed [time {sqlite3_exec_nr db $sql}]
  set tm [lindex $speed 0]

  set rate [expr {1000000.0*$numstmt/$tm}]

  set u2 $units/s
  puts [format {%12d uS %20.5f %s} $tm $rate $u2]
  global total_time
  set total_time [expr {$total_time+$tm}]
}
proc speed_trial_init {name} {
  global total_time
  set total_time 0
}
proc speed_trial_summary {name} {
  global total_time
  puts [format {%-21.21s %12d uS TOTAL} $name $total_time]
}

# The procedure uses the special "sqlite_malloc_stat" command
# (which is only available if SQLite is compiled with -DSQLITE_DEBUG=1)
# to see how many malloc()s have not been free()ed.  The number
# of surplus malloc()s is stored in the global variable $::Leak.
# If the value in $::Leak grows, it may mean there is a memory leak