Unroll the comparison loop inside keywordCode() for to avoid unnecessary

comparisions and thus help that routine run faster.

FossilOrigin-Name: cec5f920f5c2a963f88329a08a443fc04be2dd6f7f2d840be63c0ab1de898f0a
This commit is contained in:
drh 2020-02-06 15:38:43 +00:00
parent c879c4eac0
commit 0de19cac43
3 changed files with 13 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Separate\sOP_IdxInsert\sand\sOP_SorterInsert\sinto\scompletely\sseparate\sopcodes,\nhelping\seach\sone\sto\srun\sa\slittle\sfaster. C Unroll\sthe\scomparison\sloop\sinside\skeywordCode()\sfor\sto\savoid\sunnecessary\ncomparisions\sand\sthus\shelp\sthat\sroutine\srun\sfaster.
D 2020-02-06T13:57:08.833 D 2020-02-06T15:38:43.416
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -1786,7 +1786,7 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/mkautoconfamal.sh 422fc365358a2e92876ffc62971a0ff28ed472fc8bcf9de0df921c736fdeca5e F tool/mkautoconfamal.sh 422fc365358a2e92876ffc62971a0ff28ed472fc8bcf9de0df921c736fdeca5e
F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x
F tool/mkctimec.tcl dd183b73ae1c28249669741c250525f0407e579a70482371668fd5f130d9feb3 F tool/mkctimec.tcl dd183b73ae1c28249669741c250525f0407e579a70482371668fd5f130d9feb3
F tool/mkkeywordhash.c 27ffc6f6e7e3ecbfc5bca1f1f11a09fc5badf6d67557a5fb2d3b069dbed90617 F tool/mkkeywordhash.c 11a3f3af8e787d0c5ca459ed66fe80fd09e661876506e7b978ec08c19477bdc2
F tool/mkmsvcmin.tcl 6ecab9fe22c2c8de4d82d4c46797bda3d2deac8e763885f5a38d0c44a895ab33 F tool/mkmsvcmin.tcl 6ecab9fe22c2c8de4d82d4c46797bda3d2deac8e763885f5a38d0c44a895ab33
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21 F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21
@ -1858,7 +1858,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 1b6185550f2bcfa11513898984f1fc2029e0356e9acdc786c5c4a8006b1da2ba P 447d71f0867a11f789eba164ea77470b3ae4953927556304b0861cf690250776
R 6c5034c183af00de058bb8ba30ad870b R ea5228ccf18ab13503d6bdce095d9bcb
U drh U drh
Z 5ae5fcb755dbae0b5dc8eff20eb76a38 Z 1d0c980ba3c95578cb44a456472b3894

View File

@ -1 +1 @@
447d71f0867a11f789eba164ea77470b3ae4953927556304b0861cf690250776 cec5f920f5c2a963f88329a08a443fc04be2dd6f7f2d840be63c0ab1de898f0a

View File

@ -652,12 +652,17 @@ int main(int argc, char **argv){
bestSize); bestSize);
printf(" for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){\n"); printf(" for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){\n");
printf(" if( aKWLen[i]!=n ) continue;\n"); printf(" if( aKWLen[i]!=n ) continue;\n");
printf(" j = 0;\n");
printf(" zKW = &zKWText[aKWOffset[i]];\n"); printf(" zKW = &zKWText[aKWOffset[i]];\n");
printf("#ifdef SQLITE_ASCII\n"); printf("#ifdef SQLITE_ASCII\n");
printf(" if( (z[0]&~0x20)!=zKW[0] ) continue;\n");
printf(" if( (z[1]&~0x20)!=zKW[1] ) continue;\n");
printf(" j = 2;\n");
printf(" while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }\n"); printf(" while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }\n");
printf("#endif\n"); printf("#endif\n");
printf("#ifdef SQLITE_EBCDIC\n"); printf("#ifdef SQLITE_EBCDIC\n");
printf(" if( toupper(z[0])!=zKW[0] ) continue;\n");
printf(" if( toupper(z[1])!=zKW[1] ) continue;\n");
printf(" j = 2;\n");
printf(" while( j<n && toupper(z[j])==zKW[j] ){ j++; }\n"); printf(" while( j<n && toupper(z[j])==zKW[j] ){ j++; }\n");
printf("#endif\n"); printf("#endif\n");
printf(" if( j<n ) continue;\n"); printf(" if( j<n ) continue;\n");