1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Unroll a loop in the parser for a performance increase.

FossilOrigin-Name: a6dc29e4d5e13949e0fcd9d5dde575c2670eb10a230ab9df3806fc8c3016c540
This commit is contained in:
drh
2023-12-02 01:38:53 +00:00
parent 5ec9c916ad
commit 6df61985d4
3 changed files with 18 additions and 9 deletions

View File

@@ -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);