Performance improvement on the instr() function, especially for large
haystacks. FossilOrigin-Name: ce51f1a2b6a1789a5876e01cf829e45d84f3851d135a2fa5c44a56f948673a60
This commit is contained in:
parent
c0f162020e
commit
c930b405f0
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\spossible\smemory\sleak\swhen\strying\sto\sUPDATE\sa\scorrupt\sRTREE\sindex.
|
||||
D 2019-01-08T14:28:02.662
|
||||
C Performance\simprovement\son\sthe\sinstr()\sfunction,\sespecially\sfor\slarge\nhaystacks.
|
||||
D 2019-01-08T15:18:24.588
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6
|
||||
@ -467,7 +467,7 @@ F src/delete.c 209cd8345b15d1843abeff2d91a6d9c765cf32ff4abcb24411c38fe08e18baab
|
||||
F src/expr.c 9ad9c40a83c4218d79de19153b7a8ba7810564a123af7e09281927990bea2964
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c aaf28be73ab21e1e8bf4ac6b94269ebc8c93238d1e6997cb44b527b622e8ae6f
|
||||
F src/func.c 7c288b4ce309b5a8b8473514b88e1f8e69a80134509a8c0db8e39c858e367e7f
|
||||
F src/func.c 6cf832abbc2815fdb46fee654df32a66ab77deb47bf4cff04a5774dafecd497a
|
||||
F src/global.c 8291eee0782b83124de14ec0389ec9fd6ae1873358a6b0d9469fe17a46ad803b
|
||||
F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a
|
||||
F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4
|
||||
@ -1797,7 +1797,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 673a7dd698eca05bb2909fa01f962a0667361732a6d0e61cf7780ead4a07c967
|
||||
R 8b60ad3cb0e573d17f66ab6027826fe9
|
||||
P 63eb803dbc27077007dbee8def659d1523724eb73f1def1cdb68027e5c20843a
|
||||
R 174e6d1a2fb646acc0dac426835bced6
|
||||
U drh
|
||||
Z 9698f42eb061c3571f9cb42a9d8aa284
|
||||
Z 637ee479b8367750ae4cc1eec21d49de
|
||||
|
@ -1 +1 @@
|
||||
63eb803dbc27077007dbee8def659d1523724eb73f1def1cdb68027e5c20843a
|
||||
ce51f1a2b6a1789a5876e01cf829e45d84f3851d135a2fa5c44a56f948673a60
|
@ -201,6 +201,7 @@ static void instrFunc(
|
||||
int typeHaystack, typeNeedle;
|
||||
int N = 1;
|
||||
int isText;
|
||||
unsigned char firstChar;
|
||||
|
||||
UNUSED_PARAMETER(argc);
|
||||
typeHaystack = sqlite3_value_type(argv[0]);
|
||||
@ -219,7 +220,10 @@ static void instrFunc(
|
||||
isText = 1;
|
||||
}
|
||||
if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
|
||||
while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
|
||||
firstChar = zNeedle[0];
|
||||
while( nNeedle<=nHaystack
|
||||
&& (zHaystack[0]!=firstChar || memcmp(zHaystack, zNeedle, nNeedle)!=0)
|
||||
){
|
||||
N++;
|
||||
do{
|
||||
nHaystack--;
|
||||
|
Loading…
Reference in New Issue
Block a user