Further performance enhancements in zeroblob() handling.

FossilOrigin-Name: 21b0e3b75c531a5ce33a1503f9bf647d56f56a5b
This commit is contained in:
drh 2016-09-20 01:46:15 +00:00
parent 8aaf7bcc8d
commit ff535a2499
4 changed files with 26 additions and 27 deletions

View File

@ -1,5 +1,5 @@
C Avoid\sunnecessary\scalls\sto\sExpandBlob()\sfor\ssmaller\sand\sfaster\scode.
D 2016-09-20T01:19:18.064
C Further\sperformance\senhancements\sin\szeroblob()\shandling.
D 2016-09-20T01:46:15.590
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc e1aa788e84f926e42239ee167c53f785bedacacd
@ -456,10 +456,10 @@ F src/vacuum.c 913970b9d86dd6c2b8063ef1af421880f1464ec3
F src/vdbe.c 373b186a945cb69acfd6b3f53d43a3e72120ac8f
F src/vdbe.h c044be7050ac6bf596eecc6ab159f5dbc020a3b7
F src/vdbeInt.h d21f14721dd87975dc9e3bcdbf504f9c098cf611
F src/vdbeapi.c a32d61b7dd05e6890d8fd44d2805f55e2f5ba9f3
F src/vdbeapi.c 1e0505f6a5495c47180eb2e3535a9779f42e72d6
F src/vdbeaux.c b9772e4134a17f5b42d32761f5119467815c2458
F src/vdbeblob.c 3e82a797b60c3b9fed7b8de8c539ca7607874937
F src/vdbemem.c 813e7847fdbf165ab3fcb5ff4f6f04a0b0cca166
F src/vdbemem.c 07874c2ac7c05f7df1ededc6ec6650c1339b2cad
F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c
F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
F src/vtab.c e02cacb5c7ae742631edeb9ae9f53d399f093fd8
@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 46002511e52518bae14f210157f231c814c77c9e
R 571b30401865528a2fb45b091bacd258
P 5e196fd18169e84806cd45dd1a8190339323e772
R ee2363badf872b5d247f72b61c66fd19
U drh
Z a7955a17fb1911f183df0a2e3aedb1bf
Z c2808bd7f59f43e75d8ebdcaeda29a11

View File

@ -1 +1 @@
5e196fd18169e84806cd45dd1a8190339323e772
21b0e3b75c531a5ce33a1503f9bf647d56f56a5b

View File

@ -169,7 +169,7 @@ int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
const void *sqlite3_value_blob(sqlite3_value *pVal){
Mem *p = (Mem*)pVal;
if( p->flags & (MEM_Blob|MEM_Str) ){
if( sqlite3VdbeMemExpandBlob(p)!=SQLITE_OK ){
if( ExpandBlob(p)!=SQLITE_OK ){
assert( p->flags==MEM_Null && p->z==0 );
return 0;
}
@ -1775,7 +1775,7 @@ int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
UnpackedRecord *pUnpack = p->pNewUnpacked;
if( !pUnpack ){
Mem *pData = &p->v->aMem[p->iNewReg];
rc = sqlite3VdbeMemExpandBlob(pData);
rc = ExpandBlob(pData);
if( rc!=SQLITE_OK ) goto preupdate_new_out;
pUnpack = vdbeUnpackRecord(&p->keyinfo, pData->n, pData->z);
if( !pUnpack ){

View File

@ -216,25 +216,24 @@ int sqlite3VdbeMemMakeWriteable(Mem *pMem){
*/
#ifndef SQLITE_OMIT_INCRBLOB
int sqlite3VdbeMemExpandBlob(Mem *pMem){
if( pMem->flags & MEM_Zero ){
int nByte;
assert( pMem->flags&MEM_Blob );
assert( (pMem->flags&MEM_RowSet)==0 );
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
int nByte;
assert( pMem->flags & MEM_Zero );
assert( pMem->flags&MEM_Blob );
assert( (pMem->flags&MEM_RowSet)==0 );
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
/* Set nByte to the number of bytes required to store the expanded blob. */
nByte = pMem->n + pMem->u.nZero;
if( nByte<=0 ){
nByte = 1;
}
if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
return SQLITE_NOMEM_BKPT;
}
memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
pMem->n += pMem->u.nZero;
pMem->flags &= ~(MEM_Zero|MEM_Term);
/* Set nByte to the number of bytes required to store the expanded blob. */
nByte = pMem->n + pMem->u.nZero;
if( nByte<=0 ){
nByte = 1;
}
if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
return SQLITE_NOMEM_BKPT;
}
memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
pMem->n += pMem->u.nZero;
pMem->flags &= ~(MEM_Zero|MEM_Term);
return SQLITE_OK;
}
#endif