-C Update\scomments\sin\sthe\sR-Tree\smodule\sin\spreparation\sfor\ssome\sbig\schanges.\nAdd\san\s"rtree"\sperformance\stest\sto\sspeedtest1.
-D 2014-04-11T16:14:54.092
+C Add\sthe\s--verify\soption\sto\sspeedtest1.\s\sAdd\sverification\stest\scases\sto\nthe\s"rtree"\stestset\sand\sa\scase\sthat\suses\sa\scustom\sgeometry\scallback.
+D 2014-04-11T17:41:08.614
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e4ee6d36cdf6136aee0158675a3b24dd3bf31a5a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
-F test/speedtest1.c 3e06b48e8c578eaa61a01e8c7c4d8734c9dd3776
+F test/speedtest1.c 017473605f9df5f4770dd60ddb4038e6d6829916
F test/spellfix.test 61309f5efbec53603b3f86457d34a504f80abafe
F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298
F test/stat.test 76fd746b85459e812a0193410fb599f0531f22de
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 9515c8344a6743bbb0c6a6e49fb79fb3139090df
-R 57f2249bba89c44cd5839664eafe6658
-T *branch * rtree-enhancements
-T *sym-rtree-enhancements *
-T -sym-sessions *
+P 20a73ec0b2f56609a4504052e198e32803d30207
+R 47999e8bbddb67bbaef79a4f5741e58b
U drh
-Z bdd5cbefa0a4dcc9a9cc6ed610b85f71
+Z 73dffdddfd99e7f86f5cf9f646a8ff0c
" --trace Turn on SQL tracing\n"
" --utf16be Set text encoding to UTF-16BE\n"
" --utf16le Set text encoding to UTF-16LE\n"
+ " --verify Run additional verification steps.\n"
" --without-rowid Use WITHOUT ROWID where appropriate\n"
;
int bReprepare; /* True to reprepare the SQL on each rerun */
int bSqlOnly; /* True to print the SQL once only */
int bExplain; /* Print SQL with EXPLAIN prefix */
+ int bVerify; /* Try to verify that results are correct */
int szTest; /* Scale factor for test iterations */
const char *zWR; /* Might be WITHOUT ROWID */
const char *zNN; /* Might be NOT NULL */
*pX1 = x1;
}
+/* The following routine is an R-Tree geometry callback. It returns
+** true if the object overlaps a slice on the Y coordinate between the
+** two values given as arguments. In other words
+**
+** SELECT count(*) FROM rt1 WHERE id MATCH xslice(10,20);
+**
+** Is the same as saying:
+**
+** SELECT count(*) FROM rt1 WHERE y1>=10 AND y0<=20;
+*/
+static int xsliceGeometryCallback(
+ sqlite3_rtree_geometry *p,
+ int nCoord,
+ double *aCoord,
+ int *pRes
+){
+ *pRes = aCoord[3]>=p->aParam[0] && aCoord[2]<=p->aParam[1];
+ return SQLITE_OK;
+}
+
/*
** A testset for the R-Tree virtual table
*/
unsigned i, n;
unsigned mxCoord;
unsigned x0, x1, y0, y1, z0, z1;
+ unsigned iStep;
+ int *aCheck = sqlite3_malloc( sizeof(int)*g.szTest*100 );
mxCoord = g.szTest*600;
n = g.szTest*100;
speedtest1_exec("COMMIT");
speedtest1_end_test();
+ speedtest1_begin_test(101, "Copy from rtree to a regular table");
+ speedtest1_exec("CREATE TABLE t1(id INTEGER PRIMARY KEY,x0,x1,y0,y1,z0,z1)");
+ speedtest1_exec("INSERT INTO t1 SELECT * FROM rt1");
+ speedtest1_end_test();
+
n = g.szTest*20;
speedtest1_begin_test(110, "%d one-dimensional intersect slice queries", n);
speedtest1_prepare("SELECT count(*) FROM rt1 WHERE x0>=?1 AND x1<=?2");
- for(i=0; i<mxCoord; i+=(mxCoord/n)){
- sqlite3_bind_int(g.pStmt, 1, i);
- sqlite3_bind_int(g.pStmt, 2, i+mxCoord/n);
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
speedtest1_run();
+ aCheck[i] = atoi(g.zResult);
}
speedtest1_end_test();
+ if( g.bVerify ){
+ n = g.szTest*20;
+ speedtest1_begin_test(111, "Verify result from 1-D intersect slice queries");
+ speedtest1_prepare("SELECT count(*) FROM t1 WHERE x0>=?1 AND x1<=?2");
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
+ speedtest1_run();
+ if( aCheck[i]!=atoi(g.zResult) ){
+ fatal_error("Count disagree step %d: %d..%d. %d vs %d",
+ i, i*iStep, (i+1)*iStep, aCheck[i], atoi(g.zResult));
+ }
+ }
+ speedtest1_end_test();
+ }
+
n = g.szTest*20;
speedtest1_begin_test(120, "%d one-dimensional overlap slice queries", n);
speedtest1_prepare("SELECT count(*) FROM rt1 WHERE y1>=?1 AND y0<=?2");
- for(i=0; i<mxCoord; i+=(mxCoord/n)){
- sqlite3_bind_int(g.pStmt, 1, i);
- sqlite3_bind_int(g.pStmt, 2, i+mxCoord/n);
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
speedtest1_run();
+ aCheck[i] = atoi(g.zResult);
+ }
+ speedtest1_end_test();
+
+ if( g.bVerify ){
+ n = g.szTest*20;
+ speedtest1_begin_test(121, "Verify result from 1-D overlap slice queries");
+ speedtest1_prepare("SELECT count(*) FROM t1 WHERE y1>=?1 AND y0<=?2");
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
+ speedtest1_run();
+ if( aCheck[i]!=atoi(g.zResult) ){
+ fatal_error("Count disagree step %d: %d..%d. %d vs %d",
+ i, i*iStep, (i+1)*iStep, aCheck[i], atoi(g.zResult));
+ }
+ }
+ speedtest1_end_test();
+ }
+
+
+ n = g.szTest*20;
+ speedtest1_begin_test(125, "%d custom geometry callback queries", n);
+ sqlite3_rtree_geometry_callback(g.db, "xslice", xsliceGeometryCallback, 0);
+ speedtest1_prepare("SELECT count(*) FROM rt1 WHERE id MATCH xslice(?1,?2)");
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
+ speedtest1_run();
+ if( aCheck[i]!=atoi(g.zResult) ){
+ fatal_error("Count disagree step %d: %d..%d. %d vs %d",
+ i, i*iStep, (i+1)*iStep, aCheck[i], atoi(g.zResult));
+ }
}
speedtest1_end_test();
speedtest1_begin_test(130, "%d three-dimensional intersect box queries", n);
speedtest1_prepare("SELECT count(*) FROM rt1 WHERE x1>=?1 AND x0<=?2"
" AND y1>=?1 AND y0<=?2 AND z1>=?1 AND z0<=?2");
- for(i=0; i<mxCoord; i+=(mxCoord/n)){
- sqlite3_bind_int(g.pStmt, 1, i);
- sqlite3_bind_int(g.pStmt, 2, i+mxCoord/n);
+ iStep = mxCoord/n;
+ for(i=0; i<n; i++){
+ sqlite3_bind_int(g.pStmt, 1, i*iStep);
+ sqlite3_bind_int(g.pStmt, 2, (i+1)*iStep);
speedtest1_run();
+ aCheck[i] = atoi(g.zResult);
}
speedtest1_end_test();
zEncoding = "utf16le";
}else if( strcmp(z,"utf16be")==0 ){
zEncoding = "utf16be";
+ }else if( strcmp(z,"verify")==0 ){
+ g.bVerify = 1;
}else if( strcmp(z,"without-rowid")==0 ){
g.zWR = "WITHOUT ROWID";
g.zPK = "PRIMARY KEY";