Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Optimization to the sqlite3PcacheFetch() logic. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d9a0481ce0fd9824b1566f182d68ec46 |
User & Date: | drh 2015-06-30 03:57:59.045 |
Context
2015-06-30
| ||
11:07 | Change an unreachable branch into an assert() in sqlite3PagerAcquire() and optimize sqlite3PcacheOpenSavepoint() by factoring out rarely used code into a subroutine. (check-in: b406b20ecd user: drh tags: trunk) | |
03:57 | Optimization to the sqlite3PcacheFetch() logic. (check-in: d9a0481ce0 user: drh tags: trunk) | |
03:34 | Put all variable declarations for sqlite3PagerWrite() at the beginning of the block. Syntax only - no logic changes. (check-in: a0fa6b3ba5 user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 | { sqlite3_pcache_page *pBase; pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3); if( pBase==0 ){ rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); if( rc!=SQLITE_OK ) goto pager_acquire_err; } pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase); if( pPg==0 ) rc = SQLITE_NOMEM; } } if( rc!=SQLITE_OK ){ | > > > > > | 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 | { sqlite3_pcache_page *pBase; pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3); if( pBase==0 ){ rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); if( rc!=SQLITE_OK ) goto pager_acquire_err; if( pBase==0 ){ pPg = *ppPage = 0; rc = SQLITE_NOMEM; goto pager_acquire_err; } } pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase); if( pPg==0 ) rc = SQLITE_NOMEM; } } if( rc!=SQLITE_OK ){ |
︙ | ︙ | |||
5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 | DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ sqlite3_pcache_page *pPage; assert( pPager!=0 ); assert( pgno!=0 ); assert( pPager->pPCache!=0 ); pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0); assert( pPage==0 || pPager->hasBeenUsed ); return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); } /* ** Release a page reference. ** ** If the number of references to the page drop to zero, then the | > | 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 | DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ sqlite3_pcache_page *pPage; assert( pPager!=0 ); assert( pgno!=0 ); assert( pPager->pPCache!=0 ); pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0); assert( pPage==0 || pPager->hasBeenUsed ); if( pPage==0 ) return 0; return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); } /* ** Release a page reference. ** ** If the number of references to the page drop to zero, then the |
︙ | ︙ |
Changes to src/pcache.c.
︙ | ︙ | |||
317 318 319 320 321 322 323 | Pgno pgno, /* Page number obtained */ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; assert( pPage!=0 ); pPgHdr = (PgHdr*)pPage->pExtra; assert( pPgHdr->pPage==0 ); | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | Pgno pgno, /* Page number obtained */ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; assert( pPage!=0 ); pPgHdr = (PgHdr*)pPage->pExtra; assert( pPgHdr->pPage==0 ); memset(pPgHdr, 0, sizeof(PgHdr)); pPgHdr->pPage = pPage; pPgHdr->pData = pPage->pBuf; pPgHdr->pExtra = (void *)&pPgHdr[1]; memset(pPgHdr->pExtra, 0, pCache->szExtra); pPgHdr->pCache = pCache; pPgHdr->pgno = pgno; pPgHdr->flags = PGHDR_CLEAN; |
︙ | ︙ | |||
341 342 343 344 345 346 347 | PgHdr *sqlite3PcacheFetchFinish( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number obtained */ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | PgHdr *sqlite3PcacheFetchFinish( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number obtained */ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; assert( pPage!=0 ); pPgHdr = (PgHdr *)pPage->pExtra; if( !pPgHdr->pPage ){ return pcacheFetchFinishWithInit(pCache, pgno, pPage); } if( 0==pPgHdr->nRef ){ pCache->nRef++; |
︙ | ︙ |