/ Check-in [afd6fbc0]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Reduce the number of calls to strncmp() required to run editDist3Core().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: afd6fbc01052ccfc9bd29fb8f934b291b8f56af44fcae870da7e1355fe95c29a
User & Date: drh 2018-02-15 03:05:56
References
2018-03-30
16:34
Fix a bug in the spellfix extension causing it to compute suboptimal answers. The problem was introduced by check-in [afd6fbc01052ccfc9]. check-in: 3bf28fd9 user: drh tags: trunk
Context
2018-02-15
03:56
Improve performance of editdist3() by keeping the costs in sorted order. Also add a new regression test to editdist3(). check-in: dc734c5b user: drh tags: trunk
03:05
Reduce the number of calls to strncmp() required to run editDist3Core(). check-in: afd6fbc0 user: drh tags: trunk
01:03
Fix the --heap, --pagecache, --lookaside and other options to the command-line shell that invoke sqlite3_config() so that they work again. check-in: 00707f2f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/spellfix.c.

   752    752   }
   753    753   
   754    754   /*
   755    755   ** Return TRUE (non-zero) if the To side of the given cost matches
   756    756   ** the given string.
   757    757   */
   758    758   static int matchTo(EditDist3Cost *p, const char *z, int n){
          759  +  if( p->a[p->nFrom]!=z[0] ) return 0;
   759    760     if( p->nTo>n ) return 0;
   760    761     if( strncmp(p->a+p->nFrom, z, p->nTo)!=0 ) return 0;
   761    762     return 1;
   762    763   }
   763    764   
   764    765   /*
   765    766   ** Return TRUE (non-zero) if the From side of the given cost matches
   766    767   ** the given string.
   767    768   */
   768    769   static int matchFrom(EditDist3Cost *p, const char *z, int n){
   769    770     assert( p->nFrom<=n );
          771  +  if( p->a[0]!=z[0] ) return 0;
   770    772     if( strncmp(p->a, z, p->nFrom)!=0 ) return 0;
   771    773     return 1;
   772    774   }
   773    775   
   774    776   /*
   775    777   ** Return TRUE (non-zero) of the next FROM character and the next TO
   776    778   ** character are the same.
................................................................................
   779    781     EditDist3FromString *pStr,  /* Left hand string */
   780    782     int n1,                     /* Index of comparison character on the left */
   781    783     const char *z2,             /* Right-handl comparison character */
   782    784     int n2                      /* Bytes remaining in z2[] */
   783    785   ){
   784    786     int b1 = pStr->a[n1].nByte;
   785    787     if( b1>n2 ) return 0;
          788  +  if( pStr->z[n1]!=z2[0] ) return 0;
   786    789     if( strncmp(pStr->z+n1, z2, b1)!=0 ) return 0;
   787    790     return 1;
   788    791   }
   789    792   
   790    793   /*
   791    794   ** Delete an EditDist3FromString objecct
   792    795   */