/ Check-in [4e34e361]
Login

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

Overview
Comment:Performance optimizations in the rtreeStepToLeaf() routine of RTree.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4e34e3615ff31f4a6432033797b2e1a6604007ea0e501d714ecb362632776150
User & Date: drh 2019-07-20 17:43:28
Context
2019-07-20
18:00
Early detection of a corrupt R-Tree in the R-Tree search algorithm. check-in: 2bf5a4c1 user: drh tags: trunk
17:43
Performance optimizations in the rtreeStepToLeaf() routine of RTree. check-in: 4e34e361 user: drh tags: trunk
2019-07-19
15:03
New test cases added to test/fuzzdata8.db. check-in: 39be3c61 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

  1560   1560     int nConstraint = pCur->nConstraint;
  1561   1561     int ii;
  1562   1562     int eInt;
  1563   1563     RtreeSearchPoint x;
  1564   1564   
  1565   1565     eInt = pRtree->eCoordType==RTREE_COORD_INT32;
  1566   1566     while( (p = rtreeSearchPointFirst(pCur))!=0 && p->iLevel>0 ){
         1567  +    u8 *pCellData;
  1567   1568       pNode = rtreeNodeOfFirstSearchPoint(pCur, &rc);
  1568   1569       if( rc ) return rc;
  1569   1570       nCell = NCELL(pNode);
  1570   1571       assert( nCell<200 );
         1572  +    pCellData = pNode->zData + (4+pRtree->nBytesPerCell*p->iCell);
  1571   1573       while( p->iCell<nCell ){
  1572   1574         sqlite3_rtree_dbl rScore = (sqlite3_rtree_dbl)-1;
  1573         -      u8 *pCellData = pNode->zData + (4+pRtree->nBytesPerCell*p->iCell);
  1574   1575         eWithin = FULLY_WITHIN;
  1575   1576         for(ii=0; ii<nConstraint; ii++){
  1576   1577           RtreeConstraint *pConstraint = pCur->aConstraint + ii;
  1577   1578           if( pConstraint->op>=RTREE_MATCH ){
  1578   1579             rc = rtreeCallbackConstraint(pConstraint, eInt, pCellData, p,
  1579   1580                                          &rScore, &eWithin);
  1580   1581             if( rc ) return rc;
  1581   1582           }else if( p->iLevel==1 ){
  1582   1583             rtreeLeafConstraint(pConstraint, eInt, pCellData, &eWithin);
  1583   1584           }else{
  1584   1585             rtreeNonleafConstraint(pConstraint, eInt, pCellData, &eWithin);
  1585   1586           }
  1586         -        if( eWithin==NOT_WITHIN ) break;
         1587  +        if( eWithin==NOT_WITHIN ){
         1588  +          p->iCell++;
         1589  +          pCellData += pRtree->nBytesPerCell;
         1590  +          break;
         1591  +        }
  1587   1592         }
  1588         -      p->iCell++;
  1589   1593         if( eWithin==NOT_WITHIN ) continue;
         1594  +      p->iCell++;
  1590   1595         x.iLevel = p->iLevel - 1;
  1591   1596         if( x.iLevel ){
  1592   1597           x.id = readInt64(pCellData);
  1593   1598           x.iCell = 0;
  1594   1599         }else{
  1595   1600           x.id = p->id;
  1596   1601           x.iCell = p->iCell - 1;