Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the pcache module to keep track of the total number of references to all pages rather than the number of pages references, for a performance improvement and size reduction. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f00a9e1e998c4bd249a45444dc2d71a7 |
User & Date: | drh 2015-09-03 20:43:55.204 |
Context
2015-09-04
| ||
04:31 | Simplification of the LRU list handling in pcache1. (check-in: 05a3a2cd14 user: drh tags: trunk) | |
2015-09-03
| ||
20:52 | Merge performance enhancements from trunk. This branch now runs (slightly) faster than the 3.8.11.1 release, though still slightly slower than trunk. (check-in: c490bfb150 user: drh tags: begin-concurrent) | |
20:43 | Change the pcache module to keep track of the total number of references to all pages rather than the number of pages references, for a performance improvement and size reduction. (check-in: f00a9e1e99 user: drh tags: trunk) | |
18:20 | A simple optimization and size reduction in sqlite3PagerAcquire(). (check-in: 618d8dd4ff user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | |||
5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 | 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 | + + + + | const int bMmapOk = (pgno>1 && USEFETCH(pPager) && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY)) #ifdef SQLITE_HAS_CODEC && pPager->xCodec==0 #endif ); /* Optimization note: Adding the "pgno<=1" term before "pgno==0" here ** allows the compiler optimizer to reuse the results of the "pgno>1" ** test in the previous statement, and avoid testing pgno==0 in the ** common case where pgno is large. */ if( pgno<=1 && pgno==0 ){ return SQLITE_CORRUPT_BKPT; } assert( pPager->eState>=PAGER_READER ); assert( assert_pager_state(pPager) ); assert( noContent==0 || bMmapOk==0 ); |
︙ | |||
6386 6387 6388 6389 6390 6391 6392 | 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 | - + | */ u8 sqlite3PagerIsreadonly(Pager *pPager){ return pPager->readOnly; } #ifdef SQLITE_DEBUG /* |
︙ |
Changes to src/pcache.c.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + | /* ** A complete page cache is an instance of this structure. */ struct PCache { PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */ PgHdr *pSynced; /* Last synced page in dirty page list */ |
︙ | |||
180 181 182 183 184 185 186 | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | - + | } /* ** Change the page size for PCache object. The caller must ensure that there ** are no outstanding page references when this function is called. */ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ |
︙ | |||
347 348 349 350 351 352 353 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | - - + - - - - + + + - + | assert( pPage!=0 ); pPgHdr = (PgHdr *)pPage->pExtra; if( !pPgHdr->pPage ){ return pcacheFetchFinishWithInit(pCache, pgno, pPage); } |
︙ | |||
486 487 488 489 490 491 492 | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | - + - + | */ assert( p->pgno>0 ); if( ALWAYS(p->pgno>pgno) ){ assert( p->flags&PGHDR_DIRTY ); sqlite3PcacheMakeClean(p); } } |
︙ | |||
596 597 598 599 600 601 602 | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | - + + + + - + | for(p=pCache->pDirty; p; p=p->pDirtyNext){ p->pDirty = p->pDirtyNext; } return pcacheSortDirtyList(pCache->pDirty); } /* |
︙ |
Changes to src/pcache1.c.
︙ | |||
957 958 959 960 961 962 963 | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | + - + + + | PCache1 *pCache = (PCache1 *)p; PgHdr1 *pPage = 0; /* Step 1: Search the hash table for an existing entry. */ pPage = pCache->apHash[iKey % pCache->nHash]; while( pPage && pPage->iKey!=iKey ){ pPage = pPage->pNext; } /* Step 2: If the page was found in the hash table, then return it. |
︙ |