[postgis-tickets] r17601 - _ST_OrderingEquals: Avoid deserialization
Raul
raul at rmr.ninja
Mon Jul 15 03:07:04 PDT 2019
Author: algunenano
Date: 2019-07-15 03:07:03 -0700 (Mon, 15 Jul 2019)
New Revision: 17601
Modified:
trunk/NEWS
trunk/postgis/lwgeom_functions_basic.c
Log:
_ST_OrderingEquals: Avoid deserialization
Closes #4454
Closes https://github.com/postgis/postgis/pull/444
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2019-07-14 14:24:18 UTC (rev 17600)
+++ trunk/NEWS 2019-07-15 10:07:03 UTC (rev 17601)
@@ -5,7 +5,7 @@
Additional features enabled if you are running Proj6+ and PostgreSQL 12
* Major highlights *
- - #4433 32-bit hash fix (requires reindexing hash(geometry) indexes) (Raúl Marín)
+ - #4433, 32-bit hash fix (requires reindexing hash(geometry) indexes) (Raúl Marín)
- #4445, Fix a bug in geometry_le (Raúl Marín)
- #4451, Fix the calculation of gserialized_max_header_size (Raúl Marín)
- #4450, Speed up ST_GeometryType (Raúl Marín)
@@ -13,6 +13,7 @@
- #4417, Update spatial_ref_sys with new entries (Paul Ramsey)
- #4449, Speed up ST_X, ST_Y, ST_Z and ST_M (Raúl Marín)
- #4456, add Rasbery Pi 32-bit jenkins bot for testing (Bruce Rindahl)
+ - #4454, Speed up _ST_OrderingEquals (Raúl Marín)
PostGIS 3.0.0alpha3
2019/07/01
Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c 2019-07-14 14:24:18 UTC (rev 17600)
+++ trunk/postgis/lwgeom_functions_basic.c 2019-07-15 10:07:03 UTC (rev 17601)
@@ -2010,32 +2010,8 @@
{
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
- LWGEOM *lwg1, *lwg2;
- bool result;
- if ((gserialized_get_type(g1) != gserialized_get_type(g2)) ||
- (gserialized_has_z(g1) != gserialized_has_z(g2)) ||
- (gserialized_has_m(g1) != gserialized_has_m(g2)))
- {
- PG_FREE_IF_COPY(g1, 0);
- PG_FREE_IF_COPY(g2, 1);
- PG_RETURN_BOOL(false); /* different type or dimensionality */
- }
-
- /* ok, deserialize. */
- lwg1 = lwgeom_from_gserialized(g1);
- lwg2 = lwgeom_from_gserialized(g2);
-
- /* invoke appropriate function */
- result = lwgeom_same(lwg1, lwg2);
-
- /* Release memory */
- lwgeom_free(lwg1);
- lwgeom_free(lwg2);
- PG_FREE_IF_COPY(g1, 0);
- PG_FREE_IF_COPY(g2, 1);
-
- PG_RETURN_BOOL(result);
+ PG_RETURN_BOOL(gserialized_cmp(g1, g2) == 0);
}
PG_FUNCTION_INFO_V1(ST_MakeEnvelope);
More information about the postgis-tickets
mailing list