Performance optimization and very slight size reduction for OP_Column.

FossilOrigin-Name: 869c30e45cc87063be423c650f16b99e8adb3df0
This commit is contained in:
drh 2014-10-11 23:31:52 +00:00
parent d6176c4131
commit c81aa2e120
3 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Simplification\sto\sthe\sinsertCell()\sroutine\sin\sbtree.c,\sresulting\sin\sa\nperformance\sboost\sand\sa\svery\ssmall\ssize\sdecrease.\s\sIt\sturns\sout\sthat\sthe\nextra\swork\sinvolved\sin\ssometimes\savoiding\san\smemcpy()\sof\sthe\sfirst\sfour\sbytes\nof\sa\srecord\stakes\smore\stime\sthan\sjust\sunconditionally\scopying\sthose\nfour\sbytes.
D 2014-10-11T17:22:55.486
C Performance\soptimization\sand\svery\sslight\ssize\sreduction\sfor\sOP_Column.
D 2014-10-11T23:31:52.159
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -289,7 +289,7 @@ F src/update.c 729f6f18fc27740591d085e1172cebe311144bf0
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
F src/vdbe.c fee8286ff026bb9cf96ce87971b60aba53863b78
F src/vdbe.c 58c19340f009d29b63d3701bd1871aad03e4c134
F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
F src/vdbeInt.h 0b97a3190f8fbf460655985a9183019f5a702754
F src/vdbeapi.c 37a6c6ae284a97bcace365f2f0a225680c0499d9
@ -1204,7 +1204,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 5d29a033b0f17b0fd74656b28a8367a9a9067f81
R 8d2ebada6cfcd93628f86065b0703bad
P 66de15580d3c289601e67debfe1edee286f4db5f
R 512122d0d240ac7f0b4d899edd214ecb
U drh
Z b915e33ee9cbdc5e832f0d58216a79da
Z 7a9b66d8d53ebbf7b4743296d025a097

View File

@ -1 +1 @@
66de15580d3c289601e67debfe1edee286f4db5f
869c30e45cc87063be423c650f16b99e8adb3df0

View File

@ -2332,14 +2332,6 @@ case OP_Column: {
pC->iHdrOffset = getVarint32(pC->aRow, offset);
pC->nHdrParsed = 0;
aOffset[0] = offset;
if( avail<offset ){
/* pC->aRow does not have to hold the entire row, but it does at least
** need to cover the header of the record. If pC->aRow does not contain
** the complete header, then set it to zero, forcing the header to be
** dynamically allocated. */
pC->aRow = 0;
pC->szRow = 0;
}
/* Make sure a corrupt database has not given us an oversize header.
** Do this now to avoid an oversize memory allocation.
@ -2354,6 +2346,22 @@ case OP_Column: {
rc = SQLITE_CORRUPT_BKPT;
goto op_column_error;
}
if( avail<offset ){
/* pC->aRow does not have to hold the entire row, but it does at least
** need to cover the header of the record. If pC->aRow does not contain
** the complete header, then set it to zero, forcing the header to be
** dynamically allocated. */
pC->aRow = 0;
pC->szRow = 0;
}
/* The following goto is an optimization. It can be omitted and
** everything will still work. But OP_Column is measurably faster
** by skipping the subsequent conditional, which is always true.
*/
assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */
goto op_column_read_header;
}
/* Make sure at least the first p2+1 entries of the header have been
@ -2363,6 +2371,7 @@ case OP_Column: {
/* If there is more header available for parsing in the record, try
** to extract additional fields up through the p2+1-th field
*/
op_column_read_header:
if( pC->iHdrOffset<aOffset[0] ){
/* Make sure zData points to enough of the record to cover the header. */
if( pC->aRow==0 ){