SQLite

Check-in [5cd9ff87d8]
Login

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

Overview
Comment:Avoid unnecessary mutexes in the pcache1 implementation in the common case where no auxiliary page cache memory is configured.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | begin-concurrent-branch-3.19
Files: files | file ages | folders
SHA3-256: 5cd9ff87d8aa62ad97ad64b580e042b82477f6fd7b6dde1b4de7a050023c80c5
User & Date: drh 2017-08-28 17:30:34.999
Context
2017-08-28
17:32
Add the --enable-update-limit option to the ./configure script. (Leaf check-in: f545db6c27 user: drh tags: begin-concurrent-branch-3.19)
17:30
Avoid unnecessary mutexes in the pcache1 implementation in the common case where no auxiliary page cache memory is configured. (check-in: 5cd9ff87d8 user: drh tags: begin-concurrent-branch-3.19)
17:26
Remove the rarely-used scratch memory allocator. This makes the code smaller, faster, and easier to maintain. In place of the scratch allocator, add the SQLITE_CONFIG_SMALL_MALLOC configuration option that provides a hint to SQLite that large memory allocations should be avoided. (check-in: cc440400a1 user: drh tags: begin-concurrent-branch-3.19)
16:11
Avoid unnecessary mutexes in the pcache1 implementation in the common case where no auxiliary page cache memory is configured. (check-in: 1ba051e34d user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pcache1.c.
241
242
243
244
245
246
247

248
249
250
251
252
253
254
** This routine is called from sqlite3_initialize() and so it is guaranteed
** to be serialized already.  There is no need for further mutexing.
*/
void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
  if( pcache1.isInit ){
    PgFreeslot *p;
    if( pBuf==0 ) sz = n = 0;

    sz = ROUNDDOWN8(sz);
    pcache1.szSlot = sz;
    pcache1.nSlot = pcache1.nFreeSlot = n;
    pcache1.nReserve = n>90 ? 10 : (n/10 + 1);
    pcache1.pStart = pBuf;
    pcache1.pFree = 0;
    pcache1.bUnderPressure = 0;







>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
** This routine is called from sqlite3_initialize() and so it is guaranteed
** to be serialized already.  There is no need for further mutexing.
*/
void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
  if( pcache1.isInit ){
    PgFreeslot *p;
    if( pBuf==0 ) sz = n = 0;
    if( n==0 ) sz = 0;
    sz = ROUNDDOWN8(sz);
    pcache1.szSlot = sz;
    pcache1.nSlot = pcache1.nFreeSlot = n;
    pcache1.nReserve = n>90 ? 10 : (n/10 + 1);
    pcache1.pStart = pBuf;
    pcache1.pFree = 0;
    pcache1.bUnderPressure = 0;