Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the page cache so that a new sqlite3_pcache object is allocated as soon as the page cache is opened, not delayed until the first fetch request. This give a noticable performance boost. The interface between pager and the page cache has changed slightly, which might break ZIPVFS. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f1f94a971e031e784f8c30a6faf829df |
User & Date: | drh 2014-08-26 15:06:49.829 |
Context
2014-08-27
| ||
00:50 | Performance enhancement in sqlite3VdbeMemNulTerminate(). (check-in: f94cacc393 user: drh tags: trunk) | |
2014-08-26
| ||
15:06 | Change the page cache so that a new sqlite3_pcache object is allocated as soon as the page cache is opened, not delayed until the first fetch request. This give a noticable performance boost. The interface between pager and the page cache has changed slightly, which might break ZIPVFS. (check-in: f1f94a971e user: drh tags: trunk) | |
2014-08-25
| ||
22:37 | Add an assert() and five testcase() macros to the OP_Cast opcode implementation to help verify that it is fully tested. (check-in: af364cce9d user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | |||
3618 3619 3620 3621 3622 3623 3624 | 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 | - + | if( rc==SQLITE_OK ){ pager_reset(pPager); pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize); pPager->pageSize = pageSize; sqlite3PageFree(pPager->pTmpSpace); pPager->pTmpSpace = pNew; |
︙ | |||
4381 4382 4383 4384 4385 4386 4387 | 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 | - + | ** ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling ** regardless of whether or not a sync is required. This is set during ** a rollback or by user request, respectively. ** ** Spilling is also prohibited when in an error state since that could ** lead to database corruption. In the current implementaton it |
︙ | |||
4717 4718 4719 4720 4721 4722 4723 | 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 | + + + + + + + - - + + - + - - - - - - | */ if( rc==SQLITE_OK ){ assert( pPager->memDb==0 ); rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1); testcase( rc!=SQLITE_OK ); } /* Initialize the PCache object. */ if( rc==SQLITE_OK ){ assert( nExtra<1000 ); nExtra = ROUND8(nExtra); rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb, !memDb?pagerStress:0, (void *)pPager, pPager->pPCache); } |
︙ | |||
5314 5315 5316 5317 5318 5319 5320 | 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 | - + | } } if( rc!=SQLITE_OK ){ goto pager_acquire_err; } } |
︙ |
Changes to src/pcache.c.
︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | + + + + + + + + + + + | if( p->pCache->bPurgeable ){ if( p->pgno==1 ){ p->pCache->pPage1 = 0; } sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0); } } /* ** Compute the number of pages of cache requested. */ static int numberOfCachePages(PCache *p){ if( p->szCache>=0 ){ return p->szCache; }else{ return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra)); } } /*************************************************** General Interfaces ****** ** ** Initialize and shutdown the page cache subsystem. Neither of these ** functions are threadsafe. */ int sqlite3PcacheInitialize(void){ |
︙ | |||
172 173 174 175 176 177 178 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + - + + - + + + + + + + + - - - + + + + - - - + + - - - - - - - + - - - + - + - - - - - - - - - - - - - - - - - - - - - + + + + | /* ** Create a new PCache object. Storage space to hold the object ** has already been allocated and is passed in as the p pointer. ** The caller discovers how much space needs to be allocated by ** calling sqlite3PcacheSize(). */ |
︙ | |||
467 468 469 470 471 472 473 | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - - + + - | } } /* ** Close a cache. */ void sqlite3PcacheClose(PCache *pCache){ |
︙ | |||
578 579 580 581 582 583 584 | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | - - - + + - - + - - - + + - - - + + - | return p->nRef; } /* ** Return the total number of pages in the cache. */ int sqlite3PcachePagecount(PCache *pCache){ |
︙ |
Changes to src/pcache.h.
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + - + | */ void sqlite3PCacheBufferSetup(void *, int sz, int n); /* Create a new pager cache. ** Under memory stress, invoke xStress to try to make pages clean. ** Only clean and unpinned pages can be reclaimed. */ |
︙ |