mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Rework the Fts5MultiSegIter structure a bit to make it more efficient.
FossilOrigin-Name: 0778825d0ec9315c70659fae8d0640b209049dd8
This commit is contained in:
@@ -436,15 +436,6 @@ struct Fts5CResult {
|
||||
u8 bTermEq; /* True if the terms are equal */
|
||||
};
|
||||
|
||||
struct Fts5MultiSegIter {
|
||||
int nSeg; /* Size of aSeg[] array */
|
||||
int bRev; /* True to iterate in reverse order */
|
||||
int bSkipEmpty; /* True to skip deleted entries */
|
||||
int bEof; /* True at EOF */
|
||||
Fts5SegIter *aSeg; /* Array of segment iterators */
|
||||
Fts5CResult *aFirst; /* Current merge state (see above) */
|
||||
};
|
||||
|
||||
/*
|
||||
** Object for iterating through a single segment, visiting each term/docid
|
||||
** pair in the segment.
|
||||
@@ -519,6 +510,16 @@ struct Fts5SegIter {
|
||||
#define FTS5_SEGITER_REVERSE 0x02
|
||||
|
||||
|
||||
struct Fts5MultiSegIter {
|
||||
int nSeg; /* Size of aSeg[] array */
|
||||
int bRev; /* True to iterate in reverse order */
|
||||
int bSkipEmpty; /* True to skip deleted entries */
|
||||
int bEof; /* True at EOF */
|
||||
Fts5CResult *aFirst; /* Current merge state (see above) */
|
||||
Fts5SegIter aSeg[1]; /* Array of segment iterators */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** Object for iterating through the conents of a single internal node in
|
||||
** memory.
|
||||
@@ -2444,7 +2445,7 @@ static int fts5MultiIterAdvanceRowid(
|
||||
Fts5SegIter *pNew = &pIter->aSeg[iChanged];
|
||||
Fts5SegIter *pOther = &pIter->aSeg[iChanged ^ 0x0001];
|
||||
|
||||
for(i=(pIter->nSeg+iChanged)/2; p->rc==SQLITE_OK; i=i/2){
|
||||
for(i=(pIter->nSeg+iChanged)/2; 1; i=i/2){
|
||||
Fts5CResult *pRes = &pIter->aFirst[i];
|
||||
|
||||
assert( pNew->pLeaf );
|
||||
@@ -2522,12 +2523,11 @@ static Fts5MultiSegIter *fts5MultiIterAlloc(
|
||||
for(nSlot=2; nSlot<nSeg; nSlot=nSlot*2);
|
||||
pNew = fts5IdxMalloc(p,
|
||||
sizeof(Fts5MultiSegIter) + /* pNew */
|
||||
sizeof(Fts5SegIter) * nSlot + /* pNew->aSeg[] */
|
||||
sizeof(Fts5SegIter) * (nSlot-1) + /* pNew->aSeg[] */
|
||||
sizeof(Fts5CResult) * nSlot /* pNew->aFirst[] */
|
||||
);
|
||||
if( pNew ){
|
||||
pNew->nSeg = nSlot;
|
||||
pNew->aSeg = (Fts5SegIter*)&pNew[1];
|
||||
pNew->aFirst = (Fts5CResult*)&pNew->aSeg[nSlot];
|
||||
}
|
||||
return pNew;
|
||||
|
||||
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C Speed\sup\seof\schecks\son\sfts5\scursors.
|
||||
D 2015-07-03T19:13:56.700
|
||||
C Rework\sthe\sFts5MultiSegIter\sstructure\sa\sbit\sto\smake\sit\smore\sefficient.
|
||||
D 2015-07-03T20:47:18.417
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 78db7e3b643002849258892ab2a9df10c24ee63d
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -112,7 +112,7 @@ F ext/fts5/fts5_buffer.c 80f9ba4431848cb857e3d2158f5280093dcd8015
|
||||
F ext/fts5/fts5_config.c b2456e9625bca41c51d54c363e369c6356895c90
|
||||
F ext/fts5/fts5_expr.c d2e148345639c5a5583e0daa39a639bf298ae6a7
|
||||
F ext/fts5/fts5_hash.c 219f4edd72e5cf95b19c33f1058809a18fad5229
|
||||
F ext/fts5/fts5_index.c 84c8aa1c226898b781f2cbe90040a57ddc4a4259
|
||||
F ext/fts5/fts5_index.c 50f137bc97ae8c28ea555e156a01a155601cf0ff
|
||||
F ext/fts5/fts5_main.c 37b0055cb4036c4b4bb4eb36e30ebd1c21c63939
|
||||
F ext/fts5/fts5_storage.c 4cae85b5287b159d9d98174a4e70adf872b0930a
|
||||
F ext/fts5/fts5_tcl.c 85eb4e0d0fefa9420b78151496ad4599a1783e20
|
||||
@@ -1364,7 +1364,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 030f60a7ba171650ce8c0ac32dc166eab80aca32
|
||||
R 2a024a904d5b19f97eab1afbe90fa7a1
|
||||
P 3df4af5d8c28863783b0bc867abfbe31cc96f1b9
|
||||
R bd4f50649100a2ce39bd3db1b7c2671b
|
||||
U dan
|
||||
Z 8ac5a178ca95670b120c3cf4b40c3d86
|
||||
Z 0da0ca80bc4a2dfa97d128394464cd4d
|
||||
|
||||
@@ -1 +1 @@
|
||||
3df4af5d8c28863783b0bc867abfbe31cc96f1b9
|
||||
0778825d0ec9315c70659fae8d0640b209049dd8
|
||||
Reference in New Issue
Block a user