Reduce the size of VdbeCursor again, this time without a performance hit.

FossilOrigin-Name: 933939932c44bccb0958f203a5bd24e683c1cf38
This commit is contained in:
drh 2013-11-21 01:04:02 +00:00
parent 1fd522ff49
commit 5cc1023e1c
5 changed files with 20 additions and 20 deletions

View File

@ -1,5 +1,5 @@
C Unpack\ssome\sfields,\sadding\ssome\sspace\sback\sto\sthe\sVdbeCursor\sobject,\nin\sorder\sto\shelp\sthe\scode\sto\srun\sa\slittle\sfaster.
D 2013-11-21T00:10:35.929
C Reduce\sthe\ssize\sof\sVdbeCursor\sagain,\sthis\stime\swithout\sa\sperformance\shit.
D 2013-11-21T01:04:02.826
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -280,11 +280,11 @@ F src/update.c c05a0ee658f1a149e0960dfd110f3b8bd846bcb0
F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269
F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
F src/vdbe.c fb6007ac59ebebf398ce1709f9cef367bfd15dce
F src/vdbe.c c375ba0385f747e58d98686f5f4f0439c6297b35
F src/vdbe.h c06f0813f853566457ce9cfb1a4a4bc39a5da644
F src/vdbeInt.h 7cb3c641d42154ea0c66055ca77557005ff4535d
F src/vdbeInt.h 0ac03c790b8ea4568b747550ba9bbf92a8e8feb2
F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed
F src/vdbeaux.c c592609996435944837b8906fbbcfcfac0714c90
F src/vdbeaux.c bbf06ccbb159611d55e32783c6e9fdec75b120d0
F src/vdbeblob.c 8cd05a5630e6d5563ad017bf82edaf812b28acde
F src/vdbemem.c cc529bbf4f13e4e181bdb446bf6e6962ab030b4b
F src/vdbesort.c 9d83601f9d6243fe70dd0169a2820c5ddfd48147
@ -1140,7 +1140,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 5f9d50688508affd0bc8e4d52e21dacfacdbb5ce
R 11a6306351cf31959d33e284a4627112
P f8d5efcd7b92492b833b6cd1cb6bec006c6a0809
R 842b8e02c5c12ba51889f25ba6cef74b
U drh
Z 5afd15b6c955a3c65a923acb8d5d260f
Z a21060677c94bf6a3d8120f6bac96f14

View File

@ -1 +1 @@
f8d5efcd7b92492b833b6cd1cb6bec006c6a0809
933939932c44bccb0958f203a5bd24e683c1cf38

View File

@ -212,9 +212,8 @@ static VdbeCursor *allocateCursor(
int nByte;
VdbeCursor *pCx = 0;
nByte =
ROUND8(sizeof(VdbeCursor)) +
(isBtreeCursor?sqlite3BtreeCursorSize():0) +
(2*nField+2)*sizeof(u32);
ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField +
(isBtreeCursor?sqlite3BtreeCursorSize():0);
assert( iCur<p->nCursor );
if( p->apCsr[iCur] ){
@ -226,12 +225,9 @@ static VdbeCursor *allocateCursor(
memset(pCx, 0, sizeof(VdbeCursor));
pCx->iDb = iDb;
pCx->nField = nField;
if( nField ){
pCx->aType = (u32 *)&pMem->z[ROUND8(sizeof(VdbeCursor))];
}
if( isBtreeCursor ){
pCx->pCursor = (BtCursor*)
&pMem->z[ROUND8(sizeof(VdbeCursor))+(2*nField+2)*sizeof(u32)];
&pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
sqlite3BtreeCursorZero(pCx->pCursor);
}
}
@ -5807,7 +5803,6 @@ case OP_VOpen: {
pCur = allocateCursor(p, pOp->p1, 0, -1, 0);
if( pCur ){
pCur->pVtabCursor = pVtabCursor;
pCur->pModule = pVtabCursor->pVtab->pModule;
}else{
db->mallocFailed = 1;
pModule->xClose(pVtabCursor);

View File

@ -53,6 +53,9 @@ typedef struct AuxData AuxData;
** loop over all entries of the Btree. You can also insert new BTree
** entries or retrieve the key or data from the entry that the cursor
** is currently pointing to.
**
** Cursors can also point to virtual tables, sorters, or "pseudo-tables".
** A pseudo-table is a single-row table implemented by registers.
**
** Every cursor that the virtual machine has open is represented by an
** instance of the following structure.
@ -74,7 +77,6 @@ struct VdbeCursor {
Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */
Bool multiPseudo:1; /* Multi-register pseudo-cursor */
sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */
const sqlite3_module *pModule; /* Module for cursor pVtabCursor */
i64 seqCount; /* Sequence counter */
i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
i64 lastRowid; /* Rowid being deleted by OP_Delete */
@ -93,8 +95,11 @@ struct VdbeCursor {
u32 payloadSize; /* Total number of bytes in the record */
u32 szRow; /* Byte available in aRow */
u32 iHdrOffset; /* Offset to next unparsed byte of the header */
u32 *aType; /* Type values for all entries in the record */
const u8 *aRow; /* Data for the current row, if all on one page */
u32 aType[1]; /* Type values for all entries in the record */
/* 2*nField extra array elements allocated for aType[], beyond the one
** static element declared in the structure. nField total array slots for
** aType[] and nField+1 array slots for aOffset[] */
};
typedef struct VdbeCursor VdbeCursor;

View File

@ -1674,7 +1674,7 @@ void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( pCx->pVtabCursor ){
sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;
const sqlite3_module *pModule = pCx->pModule;
const sqlite3_module *pModule = pVtabCursor->pVtab->pModule;
p->inVtabMethod = 1;
pModule->xClose(pVtabCursor);
p->inVtabMethod = 0;