Faster keywordCode() implementation by taking advantage of the fact that
the input is always pure ASCII alphabetic and underscore and that the keyword table is always upper-case. FossilOrigin-Name: ff406b9701ebe3a01834837f380641c6f0c495bc
This commit is contained in:
parent
8974331fc3
commit
41aab89b31
15
manifest
15
manifest
@ -1,5 +1,5 @@
|
||||
C Demonstrate\sa\smuch\sfaster\ssqlite3GetToken()\sroutine\sby\susing\sa\slookup\stable\nto\smap\sinitial\stoken\scharacters\sinto\sa\scharacter\sclass.\s\sThis\scheck-in\sdoes\nnot\swork\sfor\sEBCDIC.\s\sMore\soptimization\sneeded.
|
||||
D 2016-02-08T02:30:50.194
|
||||
C Faster\skeywordCode()\simplementation\sby\staking\sadvantage\sof\sthe\sfact\sthat\nthe\sinput\sis\salways\spure\sASCII\salphabetic\sand\sunderscore\sand\sthat\sthe\skeyword\ntable\sis\salways\supper-case.
|
||||
D 2016-02-08T03:23:46.173
|
||||
F Makefile.in 0a957a57243a3d55e96b1514e22ffae5db9ea116
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc a3f8092763bb5d0057f0f4feb6b7fcc19713e107
|
||||
@ -1383,7 +1383,7 @@ F tool/lempar.c 3ec1463a034b37d87d782be5f6b8b10a3b1ecbe7
|
||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
||||
F tool/mkautoconfamal.sh a29b14d54302b33fd892958f6895582ea90e4a45
|
||||
F tool/mkkeywordhash.c 06ec0b78bd4fa68c12d90ef2bdfe76b039133ff8
|
||||
F tool/mkkeywordhash.c 4451824f4f68f8e8d89eba080e0c1a9cf83f7b62
|
||||
F tool/mkmsvcmin.tcl d57e6efc9428605f5418d0b235721ddf7b5d9c0b
|
||||
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
|
||||
F tool/mkopcodeh.tcl 385c62d78c38b2d92146dcb5abd319dbbc33506d
|
||||
@ -1427,10 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P ab269e720552483c5617906837e294c1be3e0a57
|
||||
R de21eeb460827c84c88aec10967c3b1d
|
||||
T *branch * tokenizer-char-class
|
||||
T *sym-tokenizer-char-class *
|
||||
T -sym-trunk *
|
||||
P 9115baa1919584dc8ca25bbff54d3b65748a9631
|
||||
R b013689cd0826a67d194ddf9700064de
|
||||
U drh
|
||||
Z 8982f608f7ca1f17154501e0dba47865
|
||||
Z b5dc027d5e497c867b371327464bbd96
|
||||
|
@ -1 +1 @@
|
||||
9115baa1919584dc8ca25bbff54d3b65748a9631
|
||||
ff406b9701ebe3a01834837f380641c6f0c495bc
|
@ -565,20 +565,23 @@ int main(int argc, char **argv){
|
||||
}
|
||||
printf("%s };\n", j==0 ? "" : "\n");
|
||||
|
||||
printf(" int h, i;\n");
|
||||
printf(" int h, i, j;\n");
|
||||
printf(" const char *zKW;\n");
|
||||
printf(" if( n>=2 ){\n");
|
||||
printf(" h = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) %% %d;\n",
|
||||
bestSize);
|
||||
printf(" for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){\n");
|
||||
printf(" if( aLen[i]==n &&"
|
||||
" sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){\n");
|
||||
printf(" if( aLen[i]!=n ) continue;\n");
|
||||
printf(" j = 0;\n");
|
||||
printf(" zKW = &zText[aOffset[i]];\n");
|
||||
printf(" while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }\n");
|
||||
printf(" if( j<n ) continue;\n");
|
||||
for(i=0; i<nKeyword; i++){
|
||||
printf(" testcase( i==%d ); /* %s */\n",
|
||||
printf(" testcase( i==%d ); /* %s */\n",
|
||||
i, aKeywordTable[i].zOrigName);
|
||||
}
|
||||
printf(" *pType = aCode[i];\n");
|
||||
printf(" break;\n");
|
||||
printf(" }\n");
|
||||
printf(" *pType = aCode[i];\n");
|
||||
printf(" break;\n");
|
||||
printf(" }\n");
|
||||
printf(" }\n");
|
||||
printf(" return n;\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user