diff options
author | drh <drh@noemail.net> | 2018-01-24 16:04:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-01-24 16:04:21 +0000 |
commit | da6bc6792fa0a647f11c73b1ee5a57f0355e39b9 (patch) | |
tree | 6ab6e6af2af8f71aad0d46b592ce74db9b475e38 /src/btree.c | |
parent | fe875027d7e03a649efe1aa35c47034a5b88fbd7 (diff) | |
download | sqlite-da6bc6792fa0a647f11c73b1ee5a57f0355e39b9.tar.gz sqlite-da6bc6792fa0a647f11c73b1ee5a57f0355e39b9.zip |
Rearrange fields of the BtCursor object so that it is smaller and requires less
initialization, for a small performance improvement.
FossilOrigin-Name: 0ddf5292cc0411ec6fcb7399ecf2904c899e0488404d3f65490fbe1db15efdf4
Diffstat (limited to 'src/btree.c')
-rw-r--r-- | src/btree.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/btree.c b/src/btree.c index 168f3105f..33f584228 100644 --- a/src/btree.c +++ b/src/btree.c @@ -4345,7 +4345,7 @@ int sqlite3BtreeCursorSize(void){ ** of run-time by skipping the initialization of those elements. */ void sqlite3BtreeCursorZero(BtCursor *p){ - memset(p, 0, offsetof(BtCursor, iPage)); + memset(p, 0, offsetof(BtCursor, BTCURSOR_FIRST_UNINIT)); } /* @@ -4668,14 +4668,15 @@ static int accessPayload( */ if( (pCur->curFlags & BTCF_ValidOvfl)==0 ){ int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize; - if( nOvfl>pCur->nOvflAlloc ){ + if( pCur->aOverflow==0 + || nOvfl*sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow) + ){ Pgno *aNew = (Pgno*)sqlite3Realloc( pCur->aOverflow, nOvfl*2*sizeof(Pgno) ); if( aNew==0 ){ return SQLITE_NOMEM_BKPT; }else{ - pCur->nOvflAlloc = nOvfl*2; pCur->aOverflow = aNew; } } |