summaryrefslogtreecommitdiffstats
path: root/test/speedtest1.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:16:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:16:44 +0000
commit62a67b10ff9f9eea6a4695649fb8252d2a4bc74d (patch)
tree7b54cadc082d323cda5fd24248e85b7d2ea664a3 /test/speedtest1.c
parentAdding debian version 3.45.3-1. (diff)
downloadsqlite3-62a67b10ff9f9eea6a4695649fb8252d2a4bc74d.tar.xz
sqlite3-62a67b10ff9f9eea6a4695649fb8252d2a4bc74d.zip
Merging upstream version 3.46.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/speedtest1.c')
-rw-r--r--test/speedtest1.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/speedtest1.c b/test/speedtest1.c
index 4f32580..5709423 100644
--- a/test/speedtest1.c
+++ b/test/speedtest1.c
@@ -2150,6 +2150,50 @@ void testset_debug1(void){
}
}
+/*
+** This testset focuses on the speed of parsing numeric literals (integers
+** and real numbers). This was added to test the impact of allowing "_"
+** characters to appear in numeric SQL literals to make them easier to read.
+** For example, "SELECT 1_000_000;" instead of "SELECT 1000000;".
+*/
+void testset_parsenumber(void){
+ const char *zSql1 = "SELECT 1, 12, 123, 1234, 12345, 123456";
+ const char *zSql2 = "SELECT 8227256643844975616, 7932208612563860480, "
+ "2010730661871032832, 9138463067404021760, "
+ "2557616153664746496, 2557616153664746496";
+ const char *zSql3 = "SELECT 1.0, 1.2, 1.23, 123.4, 1.2345, 1.23456";
+ const char *zSql4 = "SELECT 8.227256643844975616, 7.932208612563860480, "
+ "2.010730661871032832, 9.138463067404021760, "
+ "2.557616153664746496, 2.557616153664746496";
+
+ const int NROW = 100*g.szTest;
+ int ii;
+
+ speedtest1_begin_test(100, "parsing small integers");
+ for(ii=0; ii<NROW; ii++){
+ sqlite3_exec(g.db, zSql1, 0, 0, 0);
+ }
+ speedtest1_end_test();
+
+ speedtest1_begin_test(110, "parsing large integers");
+ for(ii=0; ii<NROW; ii++){
+ sqlite3_exec(g.db, zSql2, 0, 0, 0);
+ }
+ speedtest1_end_test();
+
+ speedtest1_begin_test(200, "parsing small reals");
+ for(ii=0; ii<NROW; ii++){
+ sqlite3_exec(g.db, zSql3, 0, 0, 0);
+ }
+ speedtest1_end_test();
+
+ speedtest1_begin_test(210, "parsing large reals");
+ for(ii=0; ii<NROW; ii++){
+ sqlite3_exec(g.db, zSql4, 0, 0, 0);
+ }
+ speedtest1_end_test();
+}
+
#ifdef __linux__
#include <sys/types.h>
#include <unistd.h>
@@ -2557,6 +2601,8 @@ int main(int argc, char **argv){
testset_fp();
}else if( strcmp(zThisTest,"trigger")==0 ){
testset_trigger();
+ }else if( strcmp(zThisTest,"parsenumber")==0 ){
+ testset_parsenumber();
}else if( strcmp(zThisTest,"rtree")==0 ){
#ifdef SQLITE_ENABLE_RTREE
testset_rtree(6, 147);