mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Further improvement to JSON parser performance.
FossilOrigin-Name: 144c8ccf6e5bb2527dd98742f0d67e0a16c627e7c67f754ce8ed4c4fb5b8d8b6
This commit is contained in:
32
src/json.c
32
src/json.c
@@ -1272,8 +1272,30 @@ json_parse_restart:
|
||||
parse_string:
|
||||
cDelim = z[i];
|
||||
for(j=i+1; 1; j++){
|
||||
unsigned char uc = (unsigned char)z[j];
|
||||
if( uc=='\\' ){
|
||||
static const char aOk[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
if( aOk[(unsigned char)z[j]] ) continue;
|
||||
c = z[j];
|
||||
if( c==cDelim ){
|
||||
break;
|
||||
}else if( c=='\\' ){
|
||||
c = z[++j];
|
||||
if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
|
||||
|| c=='n' || c=='r' || c=='t'
|
||||
@@ -1293,11 +1315,7 @@ json_parse_restart:
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
}
|
||||
}else if( uc>'\'' ){
|
||||
continue;
|
||||
}else if( uc==cDelim ){
|
||||
break;
|
||||
}else if( uc<=0x1f ){
|
||||
}else if( c<=0x1f ){
|
||||
/* Control characters are not allowed in strings */
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user