/ Check-in [919863b1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Small size and performance improvement in pcacheManageDirtyList() by not zeroing the PgHdr.pDirtyNext and PgHdr.pDirtyPrev pointers for PgHdr objects that are not on the dirty list.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 919863b14859d958d6c078097faae02070c7bd082e2814cf3f84bd84921e4419
User & Date: drh 2017-09-01 12:18:41
Context
2017-09-01
12:57
Remove an obsolete optimization in pcache that due to more recent changes was recently making the code a little slower. check-in: c4e7e175 user: drh tags: trunk
12:18
Small size and performance improvement in pcacheManageDirtyList() by not zeroing the PgHdr.pDirtyNext and PgHdr.pDirtyPrev pointers for PgHdr objects that are not on the dirty list. check-in: 919863b1 user: drh tags: trunk
2017-08-31
21:11
Clarify the documentation about "protected" versus "unprotected" sqlite3_value objects. No changes to code. check-in: 4094a341 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache.c.

   187    187         p->pDirty = pPage->pDirtyNext;
   188    188         assert( p->bPurgeable || p->eCreate==2 );
   189    189         if( p->pDirty==0 ){         /*OPTIMIZATION-IF-TRUE*/
   190    190           assert( p->bPurgeable==0 || p->eCreate==1 );
   191    191           p->eCreate = 2;
   192    192         }
   193    193       }
   194         -    pPage->pDirtyNext = 0;
   195         -    pPage->pDirtyPrev = 0;
   196    194     }
   197    195     if( addRemove & PCACHE_DIRTYLIST_ADD ){
   198         -    assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage );
   199         -  
          196  +    pPage->pDirtyPrev = 0;
   200    197       pPage->pDirtyNext = p->pDirty;
   201    198       if( pPage->pDirtyNext ){
   202    199         assert( pPage->pDirtyNext->pDirtyPrev==0 );
   203    200         pPage->pDirtyNext->pDirtyPrev = pPage;
   204    201       }else{
   205    202         p->pDirtyTail = pPage;
   206    203         if( p->bPurgeable ){

Changes to src/pcache.h.

    39     39     ** Elements above, except pCache, are public.  All that follow are 
    40     40     ** private to pcache.c and should not be accessed by other modules.
    41     41     ** pCache is grouped with the public elements for efficiency.
    42     42     */
    43     43     i16 nRef;                      /* Number of users of this page */
    44     44     PgHdr *pDirtyNext;             /* Next element in list of dirty pages */
    45     45     PgHdr *pDirtyPrev;             /* Previous element in list of dirty pages */
           46  +                          /* NB: pDirtyNext and pDirtyPrev are undefined if the
           47  +                          ** PgHdr object is not dirty */
    46     48   };
    47     49   
    48     50   /* Bit values for PgHdr.flags */
    49     51   #define PGHDR_CLEAN           0x001  /* Page not on the PCache.pDirty list */
    50     52   #define PGHDR_DIRTY           0x002  /* Page is on the PCache.pDirty list */
    51     53   #define PGHDR_WRITEABLE       0x004  /* Journaled and ready to modify */
    52     54   #define PGHDR_NEED_SYNC       0x008  /* Fsync the rollback journal before