Rearrange the code inside sqlite3RunParser() routine so that sqlite3Parser()

is only called from a single place.  This allows sqlite3Parser() to be
in-lined, which results in a 0.25% overall performance gain.

FossilOrigin-Name: 25d1d02b3ea126ade22b2a72649ae55509aa1777
This commit is contained in:
drh 2016-08-10 14:40:00 +00:00
parent 765fecf010
commit 167fbbe195
3 changed files with 26 additions and 23 deletions

View File

@ -1,5 +1,5 @@
C Increment\sthe\sversion\snumber\sto\s3.15.
D 2016-08-10T13:34:16.502
C Rearrange\sthe\scode\sinside\ssqlite3RunParser()\sroutine\sso\sthat\ssqlite3Parser()\nis\sonly\scalled\sfrom\sa\ssingle\splace.\s\sThis\sallows\ssqlite3Parser()\sto\sbe\nin-lined,\swhich\sresults\sin\sa\s0.25%\soverall\sperformance\sgain.
D 2016-08-10T14:40:00.773
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
@ -443,7 +443,7 @@ F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61
F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 3b29883b0ce4a6c6f643965b66b5ca6613178e59
F src/tokenize.c 78c8085bc7af1922aa687f0f4bbd716821330de5
F src/treeview.c c56d6ddbed564efda746236b35bcbb8238daac4b
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
F src/update.c 4f05ea8cddfa367d045e03589756c02199e8f9bd
@ -1510,7 +1510,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 83622f3f50030e4d6abafb99d99742928aaf157c
R d9d741532efbea2110f3ccf4d8076cf7
P 8c2701e70ab2553d7a586ff5fe7afa02d8c63199
R d55f09ced5a54b7cb7985c5709f82b8d
U drh
Z 14b0337226a0ad8779ef18ae936fbfbf
Z f780132273cb4e2f41bbf55d6f67764f

View File

@ -1 +1 @@
8c2701e70ab2553d7a586ff5fe7afa02d8c63199
25d1d02b3ea126ade22b2a72649ae55509aa1777

View File

@ -502,14 +502,26 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
assert( pParse->nVar==0 );
assert( pParse->nzVar==0 );
assert( pParse->azVar==0 );
while( zSql[i]!=0 ){
while( 1 ){
assert( i>=0 );
pParse->sLastToken.z = &zSql[i];
pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);
i += pParse->sLastToken.n;
if( i>mxSqlLen ){
pParse->rc = SQLITE_TOOBIG;
break;
if( zSql[i]!=0 ){
pParse->sLastToken.z = &zSql[i];
pParse->sLastToken.n = sqlite3GetToken((u8*)&zSql[i],&tokenType);
i += pParse->sLastToken.n;
if( i>mxSqlLen ){
pParse->rc = SQLITE_TOOBIG;
break;
}
}else{
/* Upon reaching the end of input, call the parser two more times
** with tokens TK_SEMI and 0, in that order. */
if( lastTokenParsed==TK_SEMI ){
tokenType = 0;
}else if( lastTokenParsed==0 ){
break;
}else{
tokenType = TK_SEMI;
}
}
if( tokenType>=TK_SPACE ){
assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
@ -530,15 +542,6 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
}
assert( nErr==0 );
pParse->zTail = &zSql[i];
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
assert( zSql[i]==0 );
if( lastTokenParsed!=TK_SEMI ){
sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
}
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
}
}
#ifdef YYTRACKMAXSTACKDEPTH
sqlite3_mutex_enter(sqlite3MallocMutex());
sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,