/ Check-in [1a4d8024]
Login

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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/speed1.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is measuring executing speed.
    13     13   #
    14         -# $Id: speed1.test,v 1.4 2007/03/26 16:30:16 drh Exp $
           14  +# $Id: speed1.test,v 1.5 2007/03/31 22:34:16 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
           19  +speed_trial_init speed1
    19     20   
    20     21   # Set a uniform random seed
    21     22   expr srand(0)
    22     23   
    23     24   set sqlout [open speed1.txt w]
    24     25   proc tracesql {sql} {
    25     26     puts $::sqlout $sql\;
................................................................................
   279    280   speed_trial speed1-random-del2 20000 row {
   280    281     DELETE FROM t1 WHERE rowid IN
   281    282       (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
   282    283   }
   283    284   do_test speed1-1.2 {
   284    285     db one {SELECT count(*) FROM t1}
   285    286   } 10000
          287  +speed_trial_summary speed1
   286    288   
   287    289   finish_test

Changes to test/speed2.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is measuring executing speed.
    13     13   #
    14         -# $Id: speed2.test,v 1.5 2007/03/31 15:02:50 drh Exp $
           14  +# $Id: speed2.test,v 1.6 2007/03/31 22:34:16 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
           19  +speed_trial_init speed2
    19     20   
    20     21   # Set a uniform random seed
    21     22   expr srand(0)
    22     23   
    23     24   set sqlout [open speed2.txt w]
    24     25   proc tracesql {sql} {
    25     26     puts $::sqlout $sql\;
................................................................................
   328    329   speed_trial speed2-random-del2 20000 row {
   329    330     DELETE FROM t1 WHERE rowid IN
   330    331       (SELECT rowid FROM t1 ORDER BY random() LIMIT 20000)
   331    332   }
   332    333   do_test speed2-1.2 {
   333    334     db one {SELECT count(*) FROM t1}
   334    335   } 10000
          336  +speed_trial_summary speed2
          337  +
   335    338   
   336    339   finish_test

Changes to test/tester.tcl.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements some common TCL routines used for regression
    12     12   # testing the SQLite library
    13     13   #
    14         -# $Id: tester.tcl,v 1.76 2007/03/25 19:08:47 drh Exp $
           14  +# $Id: tester.tcl,v 1.77 2007/03/31 22:34:16 drh Exp $
    15     15   
    16     16   # Make sure tclsqlite3 was compiled correctly.  Abort now with an
    17     17   # error message if not.
    18     18   #
    19     19   if {[sqlite3 -tcl-uses-utf]} {
    20     20     if {"\u1234"=="u1234"} {
    21     21       puts stderr "***** BUILD PROBLEM *****"
................................................................................
   121    121     }
   122    122   }
   123    123   
   124    124   # Run an SQL script.  
   125    125   # Return the number of microseconds per statement.
   126    126   #
   127    127   proc speed_trial {name numstmt units sql} {
   128         -  puts -nonewline [format {%-20.20s } $name...]
          128  +  puts -nonewline [format {%-21.21s } $name...]
   129    129     flush stdout
   130    130     set speed [time {sqlite3_exec_nr db $sql}]
   131    131     set tm [lindex $speed 0]
   132         -  set per [expr {$tm/(1.0*$numstmt)}]
   133    132     set rate [expr {1000000.0*$numstmt/$tm}]
   134         -  set u1 us/$units
   135    133     set u2 $units/s
   136         -  puts [format {%20.3f %-7s %20.5f %s} $per $u1 $rate $u2]
          134  +  puts [format {%12d uS %20.5f %s} $tm $rate $u2]
          135  +  global total_time
          136  +  set total_time [expr {$total_time+$tm}]
          137  +}
          138  +proc speed_trial_init {name} {
          139  +  global total_time
          140  +  set total_time 0
          141  +}
          142  +proc speed_trial_summary {name} {
          143  +  global total_time
          144  +  puts [format {%-21.21s %12d uS TOTAL} $name $total_time]
   137    145   }
   138    146   
   139    147   # The procedure uses the special "sqlite_malloc_stat" command
   140    148   # (which is only available if SQLite is compiled with -DSQLITE_DEBUG=1)
   141    149   # to see how many malloc()s have not been free()ed.  The number
   142    150   # of surplus malloc()s is stored in the global variable $::Leak.
   143    151   # If the value in $::Leak grows, it may mean there is a memory leak