From 9b2fbae706eb6a72e95f308ecaf0a5abc650ae47 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Mon, 13 Apr 2020 16:49:30 +0200 Subject: [PATCH] geometry: don't copy stuff in SHAPE_POLY_SET::GetRelativeIndices. Huge performance improvement for large polygons --- libs/kimath/src/geometry/shape_poly_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index b1a87f4f73..4525d4a535 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -104,11 +104,11 @@ bool SHAPE_POLY_SET::GetRelativeIndices( int aGlobalIdx, for( polygonIdx = 0; polygonIdx < OutlineCount(); polygonIdx++ ) { - const POLYGON currentPolygon = CPolygon( polygonIdx ); + const POLYGON& currentPolygon = CPolygon( polygonIdx ); for( contourIdx = 0; contourIdx < currentPolygon.size(); contourIdx++ ) { - SHAPE_LINE_CHAIN currentContour = currentPolygon[contourIdx]; + const SHAPE_LINE_CHAIN& currentContour = currentPolygon[contourIdx]; int totalPoints = currentContour.PointCount(); for( vertexIdx = 0; vertexIdx < totalPoints; vertexIdx++ )