Tweaks to pcache1TruncateUnsafe() to make it slightly smaller and faster and
easier to test. FossilOrigin-Name: 059f4e2efefb7b9deaf539110c19bceaeb10c6ce
This commit is contained in:
parent
167fbbe195
commit
f5dbe7f8d8
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
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
|
||||
C Tweaks\sto\spcache1TruncateUnsafe()\sto\smake\sit\sslightly\ssmaller\sand\sfaster\sand\neasier\sto\stest.
|
||||
D 2016-08-10T15:02:49.189
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
|
||||
@ -376,7 +376,7 @@ F src/pager.h 966d2769e76ae347c8a32c4165faf6e6cb64546d
|
||||
F src/parse.y 99b676e6fc2f4e331ab93e76b3987cffdbd28efa
|
||||
F src/pcache.c 5583c8ade4b05075a60ba953ef471d1c1a9c05df
|
||||
F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
|
||||
F src/pcache1.c dc8a6052e5136d6b5e6afe51f37485145646f5ab
|
||||
F src/pcache1.c 4bb7a6a5300c67d0b033d25adb509c120c03e812
|
||||
F src/pragma.c c8b499756658cb8b82cfdbb5845c22cf11f297aa
|
||||
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
|
||||
F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e
|
||||
@ -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 8c2701e70ab2553d7a586ff5fe7afa02d8c63199
|
||||
R d55f09ced5a54b7cb7985c5709f82b8d
|
||||
P 25d1d02b3ea126ade22b2a72649ae55509aa1777
|
||||
R 828a3811914080064b74ae479ed3b60e
|
||||
U drh
|
||||
Z f780132273cb4e2f41bbf55d6f67764f
|
||||
Z 4a1a54abd34521e8d97a121a8de840a3
|
||||
|
@ -1 +1 @@
|
||||
25d1d02b3ea126ade22b2a72649ae55509aa1777
|
||||
059f4e2efefb7b9deaf539110c19bceaeb10c6ce
|
@ -637,19 +637,19 @@ static void pcache1TruncateUnsafe(
|
||||
assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
|
||||
assert( pCache->iMaxKey >= iLimit );
|
||||
assert( pCache->nHash > 0 );
|
||||
if( pCache->iMaxKey - iLimit < pCache->nHash/2 ){
|
||||
if( pCache->iMaxKey - iLimit < pCache->nHash ){
|
||||
/* If we are just shaving the last few pages off the end of the
|
||||
** cache, then there is no point in scanning the entire hash table.
|
||||
** Only scan those hash slots that might contain pages that need to
|
||||
** be removed. */
|
||||
iStop = iLimit % pCache->nHash;
|
||||
h = pCache->iMaxKey % pCache->nHash;
|
||||
h = iLimit % pCache->nHash;
|
||||
iStop = pCache->iMaxKey % pCache->nHash;
|
||||
TESTONLY( nPage = -10; ) /* Disable the pCache->nPage validity check */
|
||||
}else{
|
||||
/* This is the general case where many pages are being removed.
|
||||
** It is necessary to scan the entire hash table */
|
||||
iStop = 0;
|
||||
h = pCache->nHash - 1;
|
||||
h = pCache->nHash/2;
|
||||
iStop = h - 1;
|
||||
}
|
||||
for(;;){
|
||||
PgHdr1 **pp;
|
||||
@ -668,7 +668,7 @@ static void pcache1TruncateUnsafe(
|
||||
}
|
||||
}
|
||||
if( h==iStop ) break;
|
||||
h = h ? h-1 : pCache->nHash - 1;
|
||||
h = (h+1) % pCache->nHash;
|
||||
}
|
||||
assert( nPage<0 || pCache->nPage==(unsigned)nPage );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user