Rig geopoly to use sqlite3AtoF() if it is available, as that routine is much

faster than atof().

FossilOrigin-Name: 470c6c07d0eb70806ac257c1c8ad877e041bbc14ff9a5c490edb51b2956ae726
This commit is contained in:
drh 2018-09-28 00:16:57 +00:00
parent 17e65ae4c0
commit b2d83494d3
3 changed files with 19 additions and 9 deletions

View File

@ -158,7 +158,7 @@ static int geopolyParseNumber(GeoParse *p, GeoCoord *pVal){
if( c=='0' && z[j+1]>='0' && z[j+1]<='9' ) return 0;
for(;; j++){
c = z[j];
if( c>='0' && c<='9' ) continue;
if( safe_isdigit(c) ) continue;
if( c=='.' ){
if( z[j-1]=='-' ) return 0;
if( seenDP ) return 0;
@ -180,7 +180,17 @@ static int geopolyParseNumber(GeoParse *p, GeoCoord *pVal){
break;
}
if( z[j-1]<'0' ) return 0;
if( pVal ) *pVal = (GeoCoord)atof((const char*)p->z);
if( pVal ){
#ifdef SQLITE_AMALGAMATION
/* The sqlite3AtoF() routine is much much faster than atof(), if it
** is available */
double r;
(void)sqlite3AtoF((const char*)p->z, &r, j, SQLITE_UTF8);
*pVal = r;
#else
*pVal = (GeoCoord)atof((const char*)p->z);
#endif
}
p->z += j;
return 1;
}

View File

@ -1,5 +1,5 @@
C Small\sperformance\soptimization\sin\sthe\sJSON\sparser\sof\sGeopoly.
D 2018-09-27T23:57:45.810
C Rig\sgeopoly\sto\suse\ssqlite3AtoF()\sif\sit\sis\savailable,\sas\sthat\sroutine\sis\smuch\nfaster\sthan\satof().
D 2018-09-28T00:16:57.366
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334
@ -361,7 +361,7 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782
F ext/repair/test/checkindex01.test 6945d0ffc0c1dc993b2ce88036b26e0f5d6fcc65da70fc9df27c2647bb358b0f
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c 596a1eb54134d608e70be16ec6b0d5c6b61ff3316840acee854774cb54feb1c9
F ext/rtree/geopoly.c d8eb33517c2d1a3f5ab3a8a8502d3182e4a11115749c03e969c162b47112c06a
F ext/rtree/rtree.c 6cc2e673cf1e9ea1619f13ab990f12389dfb951b131acbc2fbe164cee8992a20
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 309afc04d4287542b2cd74f933296832cc681c7b014d9405cb329b62053a5349
@ -1770,7 +1770,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P dc35f7b1754a78fa0d70c92754de07bb3c28d0d31cb929ee8a3a47ac4f3d446e
R 2619909ebdff858be51d935d42b98921
P fb520e71035258d5490be33ee28575df2caefa5d5a301c8bbdf1471551c96282
R 47c3c7c1359809e24fc02c3047f697ad
U drh
Z 5cad22a26f09f6e60075ff9733cf6357
Z ad03ded0c726f90176bebeb637053950

View File

@ -1 +1 @@
fb520e71035258d5490be33ee28575df2caefa5d5a301c8bbdf1471551c96282
470c6c07d0eb70806ac257c1c8ad877e041bbc14ff9a5c490edb51b2956ae726