Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tweaks to pcache1TruncateUnsafe() to make it slightly smaller and faster and easier to test. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
059f4e2efefb7b9deaf539110c19bcea |
User & Date: | drh 2016-08-10 15:02:49.189 |
Context
2016-08-11
| ||
13:03 | Enhance sqlite3PcacheTruncate() to run faster in the common case where the cutoff is just a few pages less than the page number highwater mark. (check-in: 03dceaea15 user: drh tags: branch-3.14) | |
2016-08-10
| ||
18:56 | Performance enhancement in the expression walker. (check-in: ebccbd9609 user: drh tags: trunk) | |
15:02 | Tweaks to pcache1TruncateUnsafe() to make it slightly smaller and faster and easier to test. (check-in: 059f4e2efe user: drh tags: trunk) | |
14:40 | Rearrange the code inside sqlite3RunParser() routine so that sqlite3Parser() is only called from a single place. This allows sqlite3Parser() to be in-lined, which results in a 0.25% overall performance gain. (check-in: 25d1d02b3e user: drh tags: trunk) | |
Changes
Changes to src/pcache1.c.
︙ | ︙ | |||
633 634 635 636 637 638 639 | unsigned int iLimit /* Drop pages with this pgno or larger */ ){ TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */ unsigned int h, iStop; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); assert( pCache->iMaxKey >= iLimit ); assert( pCache->nHash > 0 ); | | | | < | > | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | unsigned int iLimit /* Drop pages with this pgno or larger */ ){ TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */ unsigned int h, iStop; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); assert( pCache->iMaxKey >= iLimit ); assert( pCache->nHash > 0 ); if( pCache->iMaxKey - iLimit < pCache->nHash ){ /* If we are just shaving the last few pages off the end of the ** cache, then there is no point in scanning the entire hash table. ** Only scan those hash slots that might contain pages that need to ** be removed. */ h = iLimit % pCache->nHash; iStop = pCache->iMaxKey % pCache->nHash; TESTONLY( nPage = -10; ) /* Disable the pCache->nPage validity check */ }else{ /* This is the general case where many pages are being removed. ** It is necessary to scan the entire hash table */ h = pCache->nHash/2; iStop = h - 1; } for(;;){ PgHdr1 **pp; PgHdr1 *pPage; assert( h<pCache->nHash ); pp = &pCache->apHash[h]; while( (pPage = *pp)!=0 ){ if( pPage->iKey>=iLimit ){ pCache->nPage--; *pp = pPage->pNext; if( !pPage->isPinned ) pcache1PinPage(pPage); pcache1FreePage(pPage); }else{ pp = &pPage->pNext; TESTONLY( if( nPage>=0 ) nPage++; ) } } if( h==iStop ) break; h = (h+1) % pCache->nHash; } assert( nPage<0 || pCache->nPage==(unsigned)nPage ); } /******************************************************************************/ /******** sqlite3_pcache Methods **********************************************/ |
︙ | ︙ |