[postgis-tickets] [PostGIS] #4543: Use Ryū to output floating point numbers

PostGIS trac at osgeo.org
Fri Nov 8 09:53:26 PST 2019


#4543: Use Ryū to output floating point numbers
--------------------------+---------------------------
  Reporter:  Algunenano   |      Owner:  Algunenano
      Type:  enhancement  |     Status:  assigned
  Priority:  medium       |  Milestone:  PostGIS 3.1.0
 Component:  liblwgeom    |    Version:  master
Resolution:               |   Keywords:
--------------------------+---------------------------

Comment (by Algunenano):

 I've made another integration doing a simpler hack and using upstream ryu
 printf's implementation and I get way less changes (some differences in
 the exponent version that I still need to have a look at) and good
 performance:

 Before:
 {{{
 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=529.342..5680.107 rows=13
 loops=1)
  Planning Time: 0.039 ms
  Execution Time: 5680.130 ms
 (3 rows)

 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=574.798..5470.276 rows=13
 loops=1)
  Planning Time: 0.055 ms
  Execution Time: 5470.301 ms
 (3 rows)

 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=533.664..5223.448 rows=13
 loops=1)
  Planning Time: 0.078 ms
  Execution Time: 5223.478 ms
 (3 rows)
 }}}


 After:
 {{{
 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=91.176..846.130 rows=13
 loops=1)
  Planning Time: 0.077 ms
  Execution Time: 846.159 ms
 (3 rows)

 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=82.195..840.579 rows=13
 loops=1)
  Planning Time: 0.052 ms
  Execution Time: 840.601 ms
 (3 rows)

 cartodb_dev_user_3e4a6fc6-4137-4c59-bc63-066f80efb90e_db=# explain analyze
 Select ST_AsText(the_geom) from
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020;
 QUERY PLAN
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  Seq Scan on
 benchmark_4c7214d90a79aa6760367a084a4d4a2f61fbe1c6cc4f7f9e76020
 (cost=0.00..33.63 rows=13 width=32) (actual time=87.366..845.805 rows=13
 loops=1)
  Planning Time: 0.068 ms
  Execution Time: 845.830 ms
 (3 rows)
 }}}

 This new version is slower than the original hack but I've yet to
 investigate why. One possibility is that the original hack never used the
 exponential output, but that isn't an option for us AFAIK, right?

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4543#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list