[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-153-gaa450be

git at osgeo.org git at osgeo.org
Fri Nov 6 06:35:51 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  aa450be9fb5132225d93ca10b0d6f9b6590adf56 (commit)
      from  4c7c06574de31f50397e128abbadabc38b8ca71e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aa450be9fb5132225d93ca10b0d6f9b6590adf56
Author: Raúl Marín <git at rmr.ninja>
Date:   Fri Nov 6 15:25:37 2020 +0100

    Wagyu API performance improvement
    
    Comes from microbenchmarks with big polygons, where this
    is between 2 and 10% faster

diff --git a/deps/wagyu/lwgeom_wagyu.cpp b/deps/wagyu/lwgeom_wagyu.cpp
index d4efc14..b8a6823 100644
--- a/deps/wagyu/lwgeom_wagyu.cpp
+++ b/deps/wagyu/lwgeom_wagyu.cpp
@@ -54,29 +54,20 @@ ptarray_to_wglinearring(const POINTARRAY *pa, const wagyu_box &tile)
 	wagyu_coord_type min_y = min_x;
 	wagyu_coord_type max_y = max_x;
 
-	for (std::uint32_t i = 0; i < pa->npoints; i++)
+	size_t point_size = ptarray_point_size(pa);
+	size_t pa_size = pa->npoints;
+	uint8_t *buffer = pa->serialized_pointlist;
+	for (std::uint32_t i = 0; i < pa_size; i++)
 	{
-		const POINT2D *p2d = getPoint2d_cp(pa, i);
-		wagyu_point wp(static_cast<wagyu_coord_type>(p2d->x), static_cast<wagyu_coord_type>(p2d->y));
-		if (wp.x < min_x)
-		{
-			min_x = wp.x;
-		}
-		else if (wp.x > max_x)
-		{
-			max_x = wp.x;
-		}
-
-		if (wp.y < min_y)
-		{
-			min_y = wp.y;
-		}
-		else if (wp.y > max_y)
-		{
-			max_y = wp.y;
-		}
-
-		lr.push_back(std::move(wp));
+		const wagyu_coord_type x = static_cast<wagyu_coord_type>(*(double*) buffer);
+		const wagyu_coord_type y = static_cast<wagyu_coord_type>(((double*) buffer)[1]);
+		buffer += point_size;
+		min_x = std::min(min_x, x);
+		max_x = std::max(max_x, x);
+		min_y = std::min(min_y, y);
+		max_y = std::max(max_y, y);
+
+		lr.emplace_back(static_cast<wagyu_coord_type>(x), static_cast<wagyu_coord_type>(y));
 	}
 
 	/* Check how many sides of the calculated box are inside the tile */

-----------------------------------------------------------------------

Summary of changes:
 deps/wagyu/lwgeom_wagyu.cpp | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list