/ Check-in [7edf39eb]
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:Fully constraint the ORDER BY on the top-10 line of the --summary output from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7edf39eb93a8f9059a788f5fccf41c2be40afd4d
User & Date: drh 2013-11-16 15:35:18
Context
2013-11-18
03:11
Enable the ONEPASS optimization for DELETE, for both rowid and WITHOUT ROWID tables. check-in: 44a07afd user: drh tags: trunk
2013-11-16
20:13
Enhance the DELETE logic so that it can make use of WHERE_ONEPASS_DESIRED for rowid tables. check-in: 8f479a72 user: drh tags: optimize-delete
15:35
Fully constraint the ORDER BY on the top-10 line of the --summary output from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations. check-in: 7edf39eb user: drh tags: trunk
14:03
Avoid unnecessary OP_IfNull checks when doing a range query where there is a constraint on the lower bound of the range. check-in: de08a7e7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/run-wordcount.bash.

            1  +#!/bin/bash
            2  +#
            3  +# This script runs the wordcount program in different ways, comparing
            4  +# the output from each.
            5  +#
            6  +
            7  +
            8  +# Run the wordcount command with argument supplied and with --summary.
            9  +# Store the results in wc-out.txt and report the run-time.
           10  +#
           11  +function time_wordcount {
           12  +  /usr/bin/time --format='%e %C' ./wordcount --summary $* >wc-out.txt
           13  +}
           14  +
           15  +# Compare wc-out.txt against wc-baseline.txt and report any differences.
           16  +#
           17  +function compare_results {
           18  +  if cmp -s wc-out.txt wc-baseline.txt;
           19  +  then echo hi >/dev/null;
           20  +  else echo ERROR:;
           21  +       diff -u wc-baseline.txt wc-out.txt;
           22  +  fi
           23  +}
           24  +
           25  +# Select the source text to be analyzed.
           26  +#
           27  +if test "x$1" = "x";
           28  +then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
           29  +fi
           30  +
           31  +# Do test runs
           32  +#
           33  +rm -f wcdb1.db
           34  +time_wordcount wcdb1.db $* --insert
           35  +mv wc-out.txt wc-baseline.txt
           36  +rm -f wcdb2.db
           37  +time_wordcount wcdb2.db $* --insert --without-rowid
           38  +compare_results
           39  +
           40  +rm -f wcdb1.db
           41  +time_wordcount wcdb1.db $* --replace
           42  +compare_results
           43  +rm -f wcdb2.db
           44  +time_wordcount wcdb2.db $* --replace --without-rowid
           45  +compare_results
           46  +
           47  +rm -f wcdb1.db
           48  +time_wordcount wcdb1.db $* --select
           49  +compare_results
           50  +rm -f wcdb2.db
           51  +time_wordcount wcdb2.db $* --select --without-rowid
           52  +compare_results
           53  +
           54  +time_wordcount wcdb1.db $* --query
           55  +mv wc-out.txt wc-baseline.txt
           56  +time_wordcount wcdb2.db $* --query --without-rowid
           57  +compare_results
           58  +
           59  +time_wordcount wcdb1.db $* --delete
           60  +mv wc-out.txt wc-baseline.txt
           61  +time_wordcount wcdb2.db $* --delete --without-rowid
           62  +compare_results
           63  +
           64  +# Clean up temporary files created.
           65  +#
           66  +rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt

Changes to test/wordcount.c.

   455    455       sqlite3_exec(db, 
   456    456         "SELECT 'count(*):  ', count(*) FROM wordcount;\n"
   457    457         "SELECT 'sum(cnt):  ', sum(cnt) FROM wordcount;\n"
   458    458         "SELECT 'max(cnt):  ', max(cnt) FROM wordcount;\n"
   459    459         "SELECT 'avg(cnt):  ', avg(cnt) FROM wordcount;\n"
   460    460         "SELECT 'sum(cnt=1):', sum(cnt=1) FROM wordcount;\n"
   461    461         "SELECT 'top 10:    ', group_concat(word, ', ') FROM "
   462         -         "(SELECT word FROM wordcount ORDER BY cnt DESC LIMIT 10);\n"
          462  +         "(SELECT word FROM wordcount ORDER BY cnt DESC, word LIMIT 10);\n"
   463    463         "SELECT 'checksum:  ', checksum(word, cnt) FROM "
   464    464            "(SELECT word, cnt FROM wordcount ORDER BY word);\n"
   465    465         "PRAGMA integrity_check;\n",
   466    466         printResult, 0, 0);
   467    467     }
   468    468   
   469    469     /* Database connection statistics printed after both prepared statements