From 3b6cb3ceb9d4a395487f02d32bc84316be9d1f85 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 30 Sep 2013 19:05:03 +0000 Subject: [PATCH] Add some timing tests to the amatch test script. FossilOrigin-Name: ad71c72be56786d8dcf6917efd10a8d3c2d50419 --- manifest | 14 ++++++------ manifest.uuid | 2 +- test/amatch1.test | 55 ++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 1acf1cc13a..594d45a1f0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sperformance\sproblem\sin\sthe\sFTS4\sauxiliary\sfunctions\striggered\sby\san\sOR\sclause\sin\sthe\sfull-text\squery. -D 2013-09-30T18:14:45.059 +C Add\ssome\stiming\stests\sto\sthe\samatch\stest\sscript. +D 2013-09-30T19:05:03.027 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -301,7 +301,7 @@ F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060 F test/alter3.test 49c9d9fba2b8fcdce2dedeca97bbf1f369cc548d F test/alter4.test 8e93bf7a7e6919b14b0c9a6c1e4908bcf21b0165 F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc -F test/amatch1.test f459bd4e41ec54828b24f4b28319a839ab95d05a +F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f F test/analyze.test 1772936d66471c65221e437b6d1999c3a03166c4 F test/analyze3.test 412f690dfe95b337475e3e78a84a85d25f6f125d F test/analyze4.test eff2df19b8dd84529966420f29ea52edc6b56213 @@ -1117,7 +1117,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 604134732e309a738e21bcb4240b9ff285d2bfe4 -R 6a5e216c5c51e185221e1c2d8a375388 -U dan -Z 83a6f701584057aa6ad5500f631da9c2 +P fa0f2f0e3e79ae653118b901e1cca7725dfaf249 +R 489dd3466b9ca609202023a146a0691b +U drh +Z 29f4358c6829c89e7cd2273005d92246 diff --git a/manifest.uuid b/manifest.uuid index 3f571c4238..f660922ef1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fa0f2f0e3e79ae653118b901e1cca7725dfaf249 \ No newline at end of file +ad71c72be56786d8dcf6917efd10a8d3c2d50419 \ No newline at end of file diff --git a/test/amatch1.test b/test/amatch1.test index a09888c2e6..cc0f77af10 100644 --- a/test/amatch1.test +++ b/test/amatch1.test @@ -35,6 +35,7 @@ do_test amatch1-1.0 { } fts_kjv_genesis db eval { + INSERT INTO t1(t1) VALUES('optimize'); CREATE VIRTUAL TABLE temp.t1aux USING fts4aux(main, t1); SELECT term FROM t1aux WHERE col=0 ORDER BY 1 LIMIT 5 } @@ -53,20 +54,64 @@ do_test amatch1-1.2 { # Load the amatch extension load_static_extension db amatch -do_test amatch1-2.0 { - db eval { +do_execsql_test amatch1-2.0 { CREATE TABLE costs(iLang, cFrom, cTo, Cost); INSERT INTO costs VALUES(0, '', '?', 100); INSERT INTO costs VALUES(0, '?', '', 100); INSERT INTO costs VALUES(0, '?', '?', 150); + CREATE TABLE vocab(w TEXT UNIQUE); + INSERT OR IGNORE INTO vocab SELECT term FROM t1aux; CREATE VIRTUAL TABLE t2 USING approximate_match( vocabulary_table=t1aux, vocabulary_word=term, edit_distances=costs ); + CREATE VIRTUAL TABLE t3 USING approximate_match( + vocabulary_table=vocab, + vocabulary_word=w, + edit_distances=costs + ); + CREATE VIRTUAL TABLE t4 USING approximate_match( + vocabulary_table=vtemp, + vocabulary_word=w, + edit_distances=costs + ); +} {} +puts "Query against fts4aux: [time { + do_execsql_test amatch1-2.1 { + SELECT word, distance FROM t2 + WHERE word MATCH 'josxph' AND distance<300; + } {joseph 150}} 1]" +puts "Query against ordinary table: [time { + do_execsql_test amatch1-2.2 { + SELECT word, distance FROM t3 + WHERE word MATCH 'josxph' AND distance<300; + } {joseph 150}} 1]" +puts "Temp table initialized from fts4aux: [time { + do_execsql_test amatch1-2.3a { + CREATE TEMP TABLE vtemp(w TEXT UNIQUE); + INSERT OR IGNORE INTO vtemp SELECT term FROM t1aux; + } {}} 1]" +puts "Query against temp table: [time { + do_execsql_test amatch1-2.3b { + SELECT word, distance FROM t4 + WHERE word MATCH 'josxph' AND distance<300; + } {joseph 150}} 1]" +do_execsql_test amatch1-2.11 { SELECT word, distance FROM t2 - WHERE word MATCH 'josxph' AND distance<300; - } -} {joseph 150} + WHERE word MATCH 'joxxph' AND distance<=300; +} {joseph 300} +do_execsql_test amatch1-2.12 { + SELECT word, distance FROM t3 + WHERE word MATCH 'joxxph' AND distance<=300; +} {joseph 300} +do_execsql_test amatch1-2.21 { + SELECT word, distance FROM t2 + WHERE word MATCH 'joxxph' AND distance<300; +} {} +do_execsql_test amatch1-2.22 { + SELECT word, distance FROM t3 + WHERE word MATCH 'joxxph' AND distance<300; +} {} finish_test