diff options
Diffstat (limited to 'test/json')
-rw-r--r-- | test/json/README.md | 57 | ||||
-rwxr-xr-x | test/json/json-speed-check.sh | 21 | ||||
-rw-r--r-- | test/json/jsonb-q1.txt (renamed from test/json/json-q1-b.txt) | 0 |
3 files changed, 49 insertions, 29 deletions
diff --git a/test/json/README.md b/test/json/README.md index 55044ffca..4ebbda6d3 100644 --- a/test/json/README.md +++ b/test/json/README.md @@ -4,40 +4,63 @@ JSON inputs. # 1.0 Prerequisites - 1. Valgrind + * Standard SQLite build environment (SQLite source tree, compiler, make, etc.) - 2. Fossil + * Valgrind - 3. tclsh + * Fossil (only the "fossil xdiff" command is used by this procedure) + + * tclsh # 2.0 Setup - 1. Run: "`tclsh json-generator.tcl | sqlite3 json100mb.db`" to create + * Run: "`tclsh json-generator.tcl | sqlite3 json100mb.db`" to create the 100 megabyte test database. Do this so that the "json100mb.db" file lands in the directory from which you will run tests, not in the test/json subdirectory of the source tree. - 2. Build the baseline sqlite3.c file with sqlite3.h and shell.c. - ("`CFLAGS='-Os -g' make -e clean sqlite3.c`") + * Make a copy of "json100mb.db" into "jsonb100mb.db" - change the prefix + from "json" to "jsonb". + + * Bring up jsonb100mb.db in the sqlite3 command-line shell. + Convert all of the content into JSONB using a commands like this: + +> UPDATE data1 SET x=jsonb(x); +> VACUUM; + + * Build the baseline sqlite3.c file with sqlite3.h and shell.c. + +> make clean sqlite3.c - 3. Run "`sh json-speed-check.sh trunk`". This creates the baseline - profile in "jout-trunk.txt". + * Run "`sh json-speed-check.sh trunk`". This creates the baseline + profile in "jout-trunk.txt" for the preformance test using text JSON. + + * Run "`sh json-speed-check.sh trunk --jsonb`". This creates the + baseline profile in "joutb-trunk.txt" for the performance test + for processing JSONB + + * (Optional) Verify that the json100mb.db database really does contain + approximately 100MB of JSON content by running: + +> SELECT sum(length(x)) FROM data1; +> SELECT * FROM data1 WHERE NOT json_valid(x); # 3.0 Testing - 1. Build the sqlite3.c (with sqlite3.h and shell.c) to be tested. + * Build the sqlite3.c (with sqlite3.h and shell.c) to be tested. - 2. Run "`sh json-speed-check.sh x1`". The profile output will appear + * Run "`sh json-speed-check.sh x1`". The profile output will appear in jout-x1.txt. Substitute any label you want in place of "x1". - 3. Run the script shown below in the CLI. + * Run "`sh json-speed-check.sh x1 --jsonb`". The profile output will appear + in joutb-x1.txt. Substitute any label you want in place of "x1". + + * Run the script shown below in the CLI. Divide 2500 by the real elapse time from this test to get an estimate for number of MB/s that the JSON parser is able to process. -> ~~~~ -.open json100mb.db -.timer on -WITH RECURSIVE c(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c WHERE n<25) -SELECT sum(json_valid(x)) FROM c, data1; -~~~~ +> .open json100mb.db +> .timer on +> WITH RECURSIVE c(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c WHERE n<25) +> SELECT sum(json_valid(x)) FROM c, data1; diff --git a/test/json/json-speed-check.sh b/test/json/json-speed-check.sh index c57bfecd7..682a7aeed 100755 --- a/test/json/json-speed-check.sh +++ b/test/json/json-speed-check.sh @@ -35,6 +35,7 @@ LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_PROGRESS_CALLBACK" LEAN_OPTS="$LEAN_OPTS -DSQLITE_OMIT_SHARED_CACHE" LEAN_OPTS="$LEAN_OPTS -DSQLITE_USE_ALLOCA" BASELINE="trunk" +TYPE="json" doExplain=0 doCachegrind=1 doVdbeProfile=0 @@ -57,6 +58,7 @@ while test "$1" != ""; do ;; --jsonb) doJsonB=1 + TYPE="jsonb" ;; -*) CC_OPTS="$CC_OPTS $1" @@ -73,18 +75,13 @@ rm -f cachegrind.out.* jsonshell $CC -g -Os -Wall -I. $CC_OPTS ./shell.c ./sqlite3.c -o jsonshell -ldl -lpthread ls -l jsonshell | tee -a summary-$NAME.txt home=`echo $0 | sed -e 's,/[^/]*$,,'` -if test $doJsonB -eq 1; then - echo ./jsonshell json100mb_b.db "<$home/json-q1-b.txt" - valgrind --tool=cachegrind ./jsonshell json100mb_b.db <$home/json-q1-b.txt \ +DB=$TYPE''100mb.db +echo ./jsonshell $DB "<$home/$TYPE-q1.txt" +valgrind --tool=cachegrind ./jsonshell json100mb_b.db <$home/$TYPE-q1.txt \ 2>&1 | tee -a summary-$NAME.txt -else - echo ./jsonshell json100mb.db "<$home/json-q1.txt" - valgrind --tool=cachegrind ./jsonshell json100mb.db <$home/json-q1.txt \ - 2>&1 | tee -a summary-$NAME.txt -fi -cg_anno.tcl cachegrind.out.* >jout-$NAME.txt -echo '*****************************************************' >>jout-$NAME.txt -sed 's/^[0-9=-]\{9\}/==00000==/' summary-$NAME.txt >>jout-$NAME.txt +cg_anno.tcl cachegrind.out.* >$TYPE-$NAME.txt +echo '*****************************************************' >>$TYPE-$NAME.txt +sed 's/^[0-9=-]\{9\}/==00000==/' summary-$NAME.txt >>$TYPE-$NAME.txt if test "$NAME" != "$BASELINE" -a $doDiff -ne 0; then - fossil xdiff --tk -c 20 jout-$BASELINE.txt jout-$NAME.txt + fossil xdiff --tk -c 20 $TYPE-$BASELINE.txt $TYPE-$NAME.txt fi diff --git a/test/json/json-q1-b.txt b/test/json/jsonb-q1.txt index e78c63670..e78c63670 100644 --- a/test/json/json-q1-b.txt +++ b/test/json/jsonb-q1.txt |