mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Add the new PGHDR_CLEAN bit to PgHdr.flags in pcache.c. This bit is always
the opposite of PGHDR_DIRTY. Use the extra bit to avoid a comparison for a small performance boost. FossilOrigin-Name: 8619fc346d9a5a66a3c4566b4cc032b6b6bf73fd
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Very\ssmall\ssize\sreduction\sand\sperformance\sincrease\sin\ssqlite3BitvecTest().
|
C Add\sthe\snew\sPGHDR_CLEAN\sbit\sto\sPgHdr.flags\sin\spcache.c.\s\sThis\sbit\sis\salways\nthe\sopposite\sof\sPGHDR_DIRTY.\s\sUse\sthe\sextra\sbit\sto\savoid\sa\scomparison\nfor\sa\ssmall\sperformance\sboost.
|
||||||
D 2015-06-29T03:28:43.213
|
D 2015-06-29T04:21:15.041
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9
|
F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -317,8 +317,8 @@ F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
|||||||
F src/pager.c db79b64a5498e2b3a72f0f6bc74faebe48da3e95
|
F src/pager.c db79b64a5498e2b3a72f0f6bc74faebe48da3e95
|
||||||
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
|
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
|
||||||
F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8
|
F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8
|
||||||
F src/pcache.c d8b19632706dd6b81b03d0c5fd1e6bab8c13d0b9
|
F src/pcache.c 994f15b465337a079feb04aac34c199dbc610247
|
||||||
F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8
|
F src/pcache.h 445374bcf296515fb970c8bbf47c36222196d197
|
||||||
F src/pcache1.c 9ec20f98f50ed7415019303ae9bd3745d4b7bd9b
|
F src/pcache1.c 9ec20f98f50ed7415019303ae9bd3745d4b7bd9b
|
||||||
F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7
|
F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7
|
||||||
F src/pragma.h b8632d7cdda7b25323fa580e3e558a4f0d4502cc
|
F src/pragma.h b8632d7cdda7b25323fa580e3e558a4f0d4502cc
|
||||||
@@ -1364,7 +1364,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 18115164e12509ec21f34598089a7f1310048819
|
P 9b3a7281bd45994edf813a687e4b7a0761697929
|
||||||
R 01e6ba6910c7ae6426ef3c4845c78ace
|
R 07d5c4c2284ae7b5a16a8d841b25dd0d
|
||||||
U drh
|
U drh
|
||||||
Z 0a8f5dc054956bcb3a50cf01c1349d73
|
Z fa5a6a0b1c08c7af0b43f02924ea472a
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
9b3a7281bd45994edf813a687e4b7a0761697929
|
8619fc346d9a5a66a3c4566b4cc032b6b6bf73fd
|
||||||
16
src/pcache.c
16
src/pcache.c
@@ -328,6 +328,7 @@ static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit(
|
|||||||
memset(pPgHdr->pExtra, 0, pCache->szExtra);
|
memset(pPgHdr->pExtra, 0, pCache->szExtra);
|
||||||
pPgHdr->pCache = pCache;
|
pPgHdr->pCache = pCache;
|
||||||
pPgHdr->pgno = pgno;
|
pPgHdr->pgno = pgno;
|
||||||
|
pPgHdr->flags = PGHDR_CLEAN;
|
||||||
return sqlite3PcacheFetchFinish(pCache,pgno,pPage);
|
return sqlite3PcacheFetchFinish(pCache,pgno,pPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +367,7 @@ void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
|
|||||||
p->nRef--;
|
p->nRef--;
|
||||||
if( p->nRef==0 ){
|
if( p->nRef==0 ){
|
||||||
p->pCache->nRef--;
|
p->pCache->nRef--;
|
||||||
if( (p->flags&PGHDR_DIRTY)==0 ){
|
if( p->flags&PGHDR_CLEAN ){
|
||||||
pcacheUnpin(p);
|
pcacheUnpin(p);
|
||||||
}else if( p->pDirtyPrev!=0 ){
|
}else if( p->pDirtyPrev!=0 ){
|
||||||
/* Move the page to the head of the dirty list. */
|
/* Move the page to the head of the dirty list. */
|
||||||
@@ -402,11 +403,14 @@ void sqlite3PcacheDrop(PgHdr *p){
|
|||||||
** make it so.
|
** make it so.
|
||||||
*/
|
*/
|
||||||
void sqlite3PcacheMakeDirty(PgHdr *p){
|
void sqlite3PcacheMakeDirty(PgHdr *p){
|
||||||
p->flags &= ~PGHDR_DONT_WRITE;
|
|
||||||
assert( p->nRef>0 );
|
assert( p->nRef>0 );
|
||||||
if( 0==(p->flags & PGHDR_DIRTY) ){
|
if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){
|
||||||
p->flags |= PGHDR_DIRTY;
|
p->flags &= ~PGHDR_DONT_WRITE;
|
||||||
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);
|
if( p->flags & PGHDR_CLEAN ){
|
||||||
|
p->flags ^= (PGHDR_DIRTY|PGHDR_CLEAN);
|
||||||
|
assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY );
|
||||||
|
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,8 +420,10 @@ void sqlite3PcacheMakeDirty(PgHdr *p){
|
|||||||
*/
|
*/
|
||||||
void sqlite3PcacheMakeClean(PgHdr *p){
|
void sqlite3PcacheMakeClean(PgHdr *p){
|
||||||
if( (p->flags & PGHDR_DIRTY) ){
|
if( (p->flags & PGHDR_DIRTY) ){
|
||||||
|
assert( (p->flags & PGHDR_CLEAN)==0 );
|
||||||
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
|
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
|
||||||
p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC);
|
p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC);
|
||||||
|
p->flags |= PGHDR_CLEAN;
|
||||||
if( p->nRef==0 ){
|
if( p->nRef==0 ){
|
||||||
pcacheUnpin(p);
|
pcacheUnpin(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ struct PgHdr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Bit values for PgHdr.flags */
|
/* Bit values for PgHdr.flags */
|
||||||
|
#define PGHDR_CLEAN 0x001 /* Page is unchanged */
|
||||||
#define PGHDR_DIRTY 0x002 /* Page has changed */
|
#define PGHDR_DIRTY 0x002 /* Page has changed */
|
||||||
#define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before
|
#define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before
|
||||||
** writing this page to the database */
|
** writing this page to the database */
|
||||||
|
|||||||
Reference in New Issue
Block a user