Opened 6 years ago

Closed 6 years ago

#2616 closed enhancement (fixed)

Reduce geometry::text conversion in topology functions

Reported by: strk Owned by: strk
Priority: low Milestone: PostGIS 2.1.2
Component: topology Version: 2.1.x
Keywords: Cc:

Description

A single call to TopoGeo_addPolygon, against an _empty_ topology, results in 24 calls to the text(geometry) function. The second most-called function is "postgis_type_name" (6 calls).

The time spent in geometry::text is really not much (16th most expensive function) but still it sounds like something worth cleaning up.

There are 2 tasks:

  1. Avoid converting the geometry multiple times within a single function
  2. Use EXECUTE .. USING expression (to avoid conversion to text as a whole)

If someone is looking for an easy task to get used to the code, this is the perfect task :)

Change History (4)

comment:1 Changed 6 years ago by strk

r12194 does it in trunk. While doing it I realized there are much more places where USING could replace text append (but haven't done it). The number of geometry::text calls now reduced to 2 for each addPolygon call (the left-over could also be replaced by refactoring the code)

comment:2 Changed 6 years ago by strk

For the record: constructing 80k small polygons (million_poly_topo1 test dataset) now takes 25 minutes rather than one hour. Sounds like a promising imprvement ! (2x)

comment:3 Changed 6 years ago by strk

r12195 drops the left-over ::text casts from sqlmm functions -- more text casts exist in other non-constructive topology functions.

comment:4 Changed 6 years ago by strk

Resolution: fixed
Status: newclosed

r12217 drops more casts under topology, for query and export operations. I think that's all.

Note: See TracTickets for help on using tickets.