The OP_Column opcode runs faster and is smaller by manually in-lining the

code that persists string values in the output register.

FossilOrigin-Name: 36b613ccf0ddb764af90841994da91b7fcaa8f00
This commit is contained in:
drh 2014-09-19 15:28:33 +00:00
parent a5476e9254
commit 7b5ebcaf26
3 changed files with 22 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\ssqlite3VdbeMemClearAndResize()\sfunction.\s\sFix\sa\ssorting-index\nprefilter\sproblem.
D 2014-09-19T04:42:38.074
C The\sOP_Column\sopcode\sruns\sfaster\sand\sis\ssmaller\sby\smanually\sin-lining\sthe\ncode\sthat\spersists\sstring\svalues\sin\sthe\soutput\sregister.
D 2014-09-19T15:28:33.728
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -288,7 +288,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 7bc115e540282b1bfff9b43205cbf6528e6398a6
F src/vdbe.c 9f2a0a2dfa06e99feabd754e9be3a436ac3cf97d
F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
F src/vdbeInt.h f177bed1ec8d4eb5c7089f012aeb95f374745735
F src/vdbeapi.c e9e33b59834e3edc8790209765e069874c269d9d
@ -1198,8 +1198,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 9c09ac353df6041808cace41880f4729ee73f5e1 72727b68cd07969165f1f0943cc7e1a265436653
R a5960c77be61d5e92e67de5776336365
T +closed 72727b68cd07969165f1f0943cc7e1a265436653
P 987a7a211913b3949da20e43423af376f72a28ba
R 03eb020eed7bf3a8527e5a4e8f2d486b
U drh
Z 88c7b85ca090541e4ecff878bb673522
Z 0d995c472ae8295ead3b2ebd0d73fc53

View File

@ -1 +1 @@
987a7a211913b3949da20e43423af376f72a28ba
36b613ccf0ddb764af90841994da91b7fcaa8f00

View File

@ -2482,7 +2482,21 @@ case OP_Column: {
pDest->enc = encoding;
op_column_out:
Deephemeralize(pDest);
/* If the column value is an ephemeral string, go ahead and persist
** that string in case the cursor moves before the column value is
** used. The following code does the equivalent of Deephemeralize()
** but does it faster. */
if( (pDest->flags & MEM_Ephem)!=0 && pDest->z ){
u16 f = pDest->flags & (MEM_Str|MEM_Blob);
assert( f!=0 );
zData = (const u8*)pDest->z;
len = pDest->n;
if( sqlite3VdbeMemClearAndResize(pDest, len+2) ) goto no_mem;
memcpy(pDest->z, zData, len);
pDest->z[len] = 0;
pDest->z[len+1] = 0;
pDest->flags = f|MEM_Term;
}
op_column_error:
UPDATE_MAX_BLOBSIZE(pDest);
REGISTER_TRACE(pOp->p3, pDest);