/ Check-in [7cd178a7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a performance regression introduced while reworking the fts3 code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7cd178a72ab99c94fdacffb19aad819ae600e57d
User & Date: dan 2009-11-19 18:28:45
References
2009-11-19
18:30
Merge leaves [7cd178a72a] and [598727e6da]. check-in: 4115c0c2 user: dan tags: trunk
Context
2009-11-19
18:30
Merge leaves [7cd178a72a] and [598727e6da]. check-in: 4115c0c2 user: dan tags: trunk
18:28
Fix a performance regression introduced while reworking the fts3 code. check-in: 7cd178a7 user: dan tags: trunk
15:26
Merge fts3-refactor into the main trunk. check-in: 551dbe30 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to ext/fts3/fts3.c.

   922    922     int rc = SQLITE_OK;             /* Return code */
   923    923     const char *zCsr = zNode;       /* Cursor to iterate through node */
   924    924     const char *zEnd = &zCsr[nNode];/* End of interior node buffer */
   925    925     char *zBuffer = 0;              /* Buffer to load terms into */
   926    926     int nAlloc = 0;                 /* Size of allocated buffer */
   927    927   
   928    928     while( 1 ){
          929  +    int isFirstTerm = 1;          /* True when processing first term on page */
   929    930       int iHeight;                  /* Height of this node in tree */
   930    931       sqlite3_int64 iChild;         /* Block id of child node to descend to */
   931    932       int nBlock;                   /* Size of child node in bytes */
   932    933   
   933    934       zCsr += sqlite3Fts3GetVarint32(zCsr, &iHeight);
   934    935       zCsr += sqlite3Fts3GetVarint(zCsr, &iChild);
   935    936     
................................................................................
   936    937       while( zCsr<zEnd ){
   937    938         int cmp;                    /* memcmp() result */
   938    939         int nSuffix;                /* Size of term suffix */
   939    940         int nPrefix = 0;            /* Size of term prefix */
   940    941         int nBuffer;                /* Total term size */
   941    942     
   942    943         /* Load the next term on the node into zBuffer */
   943         -      if( zBuffer ){
          944  +      if( !isFirstTerm ){
   944    945           zCsr += sqlite3Fts3GetVarint32(zCsr, &nPrefix);
   945    946         }
          947  +      isFirstTerm = 0;
   946    948         zCsr += sqlite3Fts3GetVarint32(zCsr, &nSuffix);
   947    949         if( nPrefix+nSuffix>nAlloc ){
   948    950           char *zNew;
   949    951           nAlloc = (nPrefix+nSuffix) * 2;
   950    952           zNew = (char *)sqlite3_realloc(zBuffer, nAlloc);
   951    953           if( !zNew ){
   952    954             sqlite3_free(zBuffer);