]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update JSON performance testing procedures for clarity and to describe how to
authordrh <>
Sat, 6 Jan 2024 15:22:16 +0000 (15:22 +0000)
committerdrh <>
Sat, 6 Jan 2024 15:22:16 +0000 (15:22 +0000)
do performance testing of JSONB.

FossilOrigin-Name: b115b4f75bc7c4e6d9bab5edf13297f27a36f30083c80d2c502b01208da5dfc0

manifest
manifest.uuid
test/json/README.md
test/json/json-speed-check.sh
test/json/jsonb-q1.txt [moved from test/json/json-q1-b.txt with 100% similarity]

index f279291b3ee1aee472bebc50cfec4cf9ed440c1e..fe5590010e4d156ec48dfd27af92081f5b9fda87 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sextension\sext/misc/totext.c\sto\savoid\sboth\subsan\swarnings\sand\sdubious\sreal->integer\sconversions.
-D 2024-01-06T13:58:54.947
+C Update\sJSON\sperformance\stesting\sprocedures\sfor\sclarity\sand\sto\sdescribe\show\sto\ndo\sperformance\stesting\sof\sJSONB.
+D 2024-01-06T15:22:16.679
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1330,11 +1330,11 @@ F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ff
 F test/jrnlmode.test 9b5bc01dac22223cb60ec2d5f97acf568d73820794386de5634dcadbea9e1946
 F test/jrnlmode2.test 8759a1d4657c064637f8b079592651530db738419e1d649c6df7048cd724363d
 F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
-F test/json/README.md 63e3e589e1df8fd3cc1588ba1faaff659214003f8b77a15af5c6452b35e30ee2
+F test/json/README.md de59d5ba0bd2796d797115688630a6405bbf43a2891bad445ac6b9f38b83f236
 F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd28656fb261bddc8a3f
-F test/json/json-q1-b.txt 1e180fe6491efab307e318b22879e3a736ac9a96539bbde7911a13ee5b33abc7
 F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307
-F test/json/json-speed-check.sh b060a9a6c696c0a807d8929400fa11bd7113edc58b0d66b9795f424f8d0db326 x
+F test/json/json-speed-check.sh 912ee03e700a65c827ee0c7b4752c21ec5ef69cf7679d2f482ca817042bead52 x
+F test/json/jsonb-q1.txt 1e180fe6491efab307e318b22879e3a736ac9a96539bbde7911a13ee5b33abc7 w test/json/json-q1-b.txt
 F test/json101.test 70587d7d35ef9e2126364ba70f0c951f70827cfbd28649d779ff3df7e8f87547
 F test/json102.test 557a46e16df1aa9bdbc4076a71a45814ea0e7503d6621d87d42a8c04cbc2b0ef
 F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
@@ -2156,9 +2156,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8940e2a1054fbc19fae3f76e743d744840c3a5aad001be8d3d56ca134226c34b c626aa108a7a30cef54af8d93ac9e45749568ed38e4e06623a6bad6b4bf6e8ec
-R a29b7304699ca19c7db12a157b970ee6
-T +closed c626aa108a7a30cef54af8d93ac9e45749568ed38e4e06623a6bad6b4bf6e8ec
-U dan
-Z 28d29fe86f310229597cb641cf92c44b
+P 541436004df6458dc2f38bdfa421099f78cab397f5f4795ca5f227531aaa6a3e
+R c74cb5aaebf0a262676ed62bd81f26fe
+U drh
+Z 94bd0ff810d06e79fd9f6572dcfe8940
 # Remove this line to create a well-formed Fossil manifest.
index 87dc33021284bfb59a8233b33fd2c61c09e81a73..45a17378c9ecb657544d11ce1e0f0384d9462494 100644 (file)
@@ -1 +1 @@
-541436004df6458dc2f38bdfa421099f78cab397f5f4795ca5f227531aaa6a3e
\ No newline at end of file
+b115b4f75bc7c4e6d9bab5edf13297f27a36f30083c80d2c502b01208da5dfc0
\ No newline at end of file
index 55044ffca747c0e666f4a40beb94103f886fe774..4ebbda6d3fc5a4d7654cecf211bef0e39284812d 100644 (file)
@@ -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;
index c57bfecd7aa183604cd67054707f849d126edade..682a7aeeddf65cab237f480ffca9841cad194256 100755 (executable)
@@ -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