/ Check-in [3c4c0126]

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

Overview
Comment: Completely unroll the dimension loop inside of cellArea() in RTREE. Tarball | ZIP archive | SQL archive family | ancestors | descendants | both | files | file ages | folders 3c4c0126c287f844220b65e00fec17c059fbb7c8 drh 2017-02-01 16:41:30
Context
 2017-02-01 17:08 Unwind the RTREE dimension loop inside of rtreeCallbackConstraint(). check-in: 4854ea9c user: drh tags: trunk 16:41 Completely unroll the dimension loop inside of cellArea() in RTREE. check-in: 3c4c0126 user: drh tags: trunk 15:49 Precompute the nDim2 value in the Rtree object and use that to make loops over coordinates faster. check-in: f1f3c8cc user: drh tags: trunk
Changes

Changes to ext/rtree/rtree.c.

 ```1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 ``` ``` return rc; } /* ** Return the N-dimensional volumn of the cell stored in *p. */ static RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){ RtreeDValue area; int ii; area = DCOORD(p->aCoord[1]) - DCOORD(p->aCoord[0]); for(ii=2; iinDim2; ii+=2){ area *= DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]); } return area; } /* ** Return the margin length of cell p. The margin length is the sum ** of the objects size in each dimension. ``` ``` | | | > | < > > > > > > > > > > > > > > > > ``` ```1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 ``` ``` return rc; } /* ** Return the N-dimensional volumn of the cell stored in *p. */ static RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){ RtreeDValue area = (RtreeDValue)1; assert( pRtree->nDim>=1 && pRtree->nDim<=5 ); #ifndef SQLITE_RTREE_INT_ONLY if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ switch( pRtree->nDim ){ case 5: area = p->aCoord[9].f - p->aCoord[8].f; case 4: area *= p->aCoord[7].f - p->aCoord[6].f; case 3: area *= p->aCoord[5].f - p->aCoord[4].f; case 2: area *= p->aCoord[3].f - p->aCoord[2].f; default: area *= p->aCoord[1].f - p->aCoord[0].f; } }else #endif { switch( pRtree->nDim ){ case 5: area = p->aCoord[9].i - p->aCoord[8].i; case 4: area *= p->aCoord[7].i - p->aCoord[6].i; case 3: area *= p->aCoord[5].i - p->aCoord[4].i; case 2: area *= p->aCoord[3].i - p->aCoord[2].i; default: area *= p->aCoord[1].i - p->aCoord[0].i; } } return area; } /* ** Return the margin length of cell p. The margin length is the sum ** of the objects size in each dimension. ```