[postgis-tickets] [PostGIS] #4372: PROJ 6: 4x slowdown over points
PostGIS
trac at osgeo.org
Tue Jun 18 07:49:55 PDT 2019
#4372: PROJ 6: 4x slowdown over points
-------------------------+---------------------------
Reporter: Algunenano | Owner: Algunenano
Type: defect | Status: assigned
Priority: high | Milestone: PostGIS 3.0.0
Component: postgis | Version: trunk
Resolution: | Keywords:
-------------------------+---------------------------
Comment (by Algunenano):
I've replaced the PR with https://github.com/postgis/postgis/pull/423
What this does:
- Cleans up configure.ac when running under PROJ6 (avoids error message
that its ignored).
- PROJ 6+ (and only 6+):
- Caches source_swapped / target_swapped for all PJs. This brings
ST_Transform to, more or less, almost the same performance as 5.1 (except
the first row, which creates the PJ).
- Caches source_is_latlong / source_semi_major_metre /
source_semi_minor_metre when required (source srid == target srid). This
brings a bunch of functions (ST_AsTWKB, geography functions) to, more or
less, the same performance as before (except the first row, which creates
the PJ).
- Uses `proj_trans` instead of `proj_trans_generic` for single points
(faster and makes it on par of 5.2 performance for that case).
- PROJ (all releases):
- Allocate auxiliar memory (LWPROJ / PJ) in the parent memory context
instead of manually using malloc/free.
- Avoid double lookup (one to check if the item is in the cache, one for
retrieval).
- Increases PROJ_CACHE_ITEMS from **16** to **128**.
PROJ_BACKEND_HASH_SIZE goes from **32** to **256**. This is to minimize
the huge impact of creating projections between 5.2 and 6.1, specially for
ST_Buffer(geography) which autogenerates srids based on
`SRID_RESERVE_OFFSET`. There are over 120+ used SRIDs in that range, so
deleting and recreating PJs is a huge performance loss (it isn't as bad
for 5.1 since PJ creation is much faster).
- Removes the call to `proj_context_set_search_paths`. AFAIK, we don't
distribute proj files anymore so this is legacy. It's also preventing the
default proj installation of finding proj.db and using the fallback method
(faster but more imprecise). If it breaks something, I'll consider reading
it just for Windows (as it's mentioned in the comments of the function).
Any comments are welcome. I'll try to break this down into several commits
for clarity.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4372#comment:11>
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