mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Avoid unnecessary zeroing of fields in the MemPage object that are going
to be reinitialized before use anyhow. A smaller and faster binary results. FossilOrigin-Name: 01ada3d1068476f90dcae02cb089001ea4bcc23d
This commit is contained in:
@@ -3955,7 +3955,8 @@ static int pagerAcquireMapPage(
|
||||
*ppPage = p = pPager->pMmapFreelist;
|
||||
pPager->pMmapFreelist = p->pDirty;
|
||||
p->pDirty = 0;
|
||||
memset(p->pExtra, 0, pPager->nExtra);
|
||||
assert( pPager->nExtra>=8 );
|
||||
memset(p->pExtra, 0, 8);
|
||||
}else{
|
||||
*ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
|
||||
if( p==0 ){
|
||||
@@ -4555,7 +4556,9 @@ int sqlite3PagerFlush(Pager *pPager){
|
||||
**
|
||||
** The nExtra parameter specifies the number of bytes of space allocated
|
||||
** along with each page reference. This space is available to the user
|
||||
** via the sqlite3PagerGetExtra() API.
|
||||
** via the sqlite3PagerGetExtra() API. When a new page is allocated, the
|
||||
** first 8 bytes of this space are zeroed but the remainder is uninitialized.
|
||||
** (The extra space is used by btree as the MemPage object.)
|
||||
**
|
||||
** The flags argument is used to specify properties that affect the
|
||||
** operation of the pager. It should be passed some bitwise combination
|
||||
@@ -4785,8 +4788,8 @@ act_like_temp_file:
|
||||
|
||||
/* Initialize the PCache object. */
|
||||
if( rc==SQLITE_OK ){
|
||||
assert( nExtra<1000 );
|
||||
nExtra = ROUND8(nExtra);
|
||||
assert( nExtra>=8 && nExtra<1000 );
|
||||
rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,
|
||||
!memDb?pagerStress:0, (void *)pPager, pPager->pPCache);
|
||||
}
|
||||
|
Reference in New Issue
Block a user