diff options
author | drh <drh@noemail.net> | 2016-02-03 22:14:38 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-02-03 22:14:38 +0000 |
commit | fabe393da8f09bee7f40781e2bae9edacebe8619 (patch) | |
tree | 603d45875b971d3e32470d0830f2d1791645c8ae /src | |
parent | eb715c62f9367794b11cc9210a9e61a4a1943b04 (diff) | |
download | sqlite-fabe393da8f09bee7f40781e2bae9edacebe8619.tar.gz sqlite-fabe393da8f09bee7f40781e2bae9edacebe8619.zip |
In the VDBE loop, only check for OOM errors at jumps rather than after every
opcode, for about a 0.5% performance increase.
FossilOrigin-Name: 632071bac5ff324a74cec9bdbba2deb60c0945e9
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index 62ad86d4f..fd90d3b0d 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -629,7 +629,6 @@ int sqlite3VdbeExec( #endif for(pOp=&aOp[p->pc]; rc==SQLITE_OK; pOp++){ assert( pOp>=aOp && pOp<&aOp[p->nOp]); - if( db->mallocFailed ) goto no_mem; #ifdef VDBE_PROFILE start = sqlite3Hwtime(); #endif @@ -754,14 +753,16 @@ jump_to_p2_and_check_for_interrupt: /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, OP_RowSetNext, or OP_SorterNext) all jump here upon ** completion. Check to see if sqlite3_interrupt() has been called - ** or if the progress callback needs to be invoked. + ** or if the progress callback needs to be invoked. Also check for + ** OOM conditions and abort if seen. ** ** This code uses unstructured "goto" statements and does not look clean. ** But that is not due to sloppy coding habits. The code is written this ** way for performance, to avoid having to run the interrupt and progress - ** checks on every opcode. This helps sqlite3_step() to run about 1.5% + ** checks on every opcode. This helps sqlite3_step() to run over 2.0% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + if( db->mallocFailed ) goto no_mem; if( db->u1.isInterrupted ) goto abort_due_to_interrupt; #ifndef SQLITE_OMIT_PROGRESS_CALLBACK /* Call the progress callback if it is configured and the required number |