aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-12-02 01:38:53 +0000
committerdrh <>2023-12-02 01:38:53 +0000
commit6df61985d4930d11d6f6fe65997b54f512e9aff5 (patch)
treebd0b69ac0380ee5c423cc5524c5d922c2f93d183 /src/json.c
parent5ec9c916ad97600b14871534137b0bc3bfd5bf49 (diff)
downloadsqlite-6df61985d4930d11d6f6fe65997b54f512e9aff5.tar.gz
sqlite-6df61985d4930d11d6f6fe65997b54f512e9aff5.zip
Unroll a loop in the parser for a performance increase.
FossilOrigin-Name: a6dc29e4d5e13949e0fcd9d5dde575c2670eb10a230ab9df3806fc8c3016c540
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index 6c86d98f2..62e3d652f 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1391,8 +1391,16 @@ json_parse_restart:
opcode = JSONB_TEXT;
parse_string:
cDelim = z[i];
- for(j=i+1; 1; j++){
- if( jsonIsOk[(unsigned char)z[j]] ) continue;
+ j = i+1;
+ while( 1 /*exit-by-break*/ ){
+ if( jsonIsOk[(u8)z[j]] ){
+ if( jsonIsOk[(u8)z[j+1]] ){
+ j += 2;
+ continue;
+ }else{
+ j += 1;
+ }
+ }
c = z[j];
if( c==cDelim ){
break;
@@ -1421,6 +1429,7 @@ json_parse_restart:
pParse->iErr = j;
return -1;
}
+ j++;
}
jsonBlobAppendNodeType(pParse, opcode, j-1-i);
jsonBlobAppendNBytes(pParse, (const u8*)&z[i+1], j-1-i);