You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2022/09/20 05:15:45 UTC
[lucene] branch main updated: Improve tessellator performance by delaying calls to the method #isIntersectingPolygon (#11786)
This is an automated email from the ASF dual-hosted git repository.
ivera pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new ecb0ba542bf Improve tessellator performance by delaying calls to the method #isIntersectingPolygon (#11786)
ecb0ba542bf is described below
commit ecb0ba542bfec1bd18174933ddfe3c24eb22d203
Author: Ignacio Vera <iv...@apache.org>
AuthorDate: Tue Sep 20 07:15:38 2022 +0200
Improve tessellator performance by delaying calls to the method #isIntersectingPolygon (#11786)
---
lucene/CHANGES.txt | 3 +++
lucene/core/src/java/org/apache/lucene/geo/Tessellator.java | 10 ++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4d0bf33ecb6..242bac523d7 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -98,6 +98,9 @@ Improvements
* GITHUB#11778: Detailed part-of-speech information for particle(조사) and ending(어미) on Nori
is now tagged. (Namgyu Kim)
+* GITHUB#11785: Improve Tessellator performance by delaying calls to the method
+ #isIntersectingPolygon (Ignacio Vera)
+
Bug Fixes
---------------------
* GITHUB#11726: Indexing term vectors on large documents could fail due to
diff --git a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java
index e93958a96d3..8a3fcc16173 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java
@@ -772,7 +772,6 @@ public final class Tessellator {
// a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])
if (isVertexEquals(a, b) == false
- && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false
&& linesIntersect(
a.getX(),
a.getY(),
@@ -783,7 +782,9 @@ public final class Tessellator {
b.getX(),
b.getY())
&& isLocallyInside(a, b)
- && isLocallyInside(b, a)) {
+ && isLocallyInside(b, a)
+ // this call is expensive so do it last
+ && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false) {
// compute edges from polygon
boolean abFromPolygon =
(a.next == node)
@@ -1117,7 +1118,6 @@ public final class Tessellator {
}
return a.next.idx != b.idx
&& a.previous.idx != b.idx
- && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false
&& isLocallyInside(a, b)
&& isLocallyInside(b, a)
&& isLocallyInside(a.previous, b)
@@ -1127,7 +1127,9 @@ public final class Tessellator {
&& area(a.previous.getX(), a.previous.getY(), a.getX(), a.getY(), b.getX(), b.getY()) != 0
&& area(a.getX(), a.getY(), b.getX(), b.getY(), b.next.getX(), b.next.getY()) != 0
&& area(a.next.getX(), a.next.getY(), a.getX(), a.getY(), b.getX(), b.getY()) != 0
- && area(a.getX(), a.getY(), b.getX(), b.getY(), b.previous.getX(), b.previous.getY()) != 0;
+ && area(a.getX(), a.getY(), b.getX(), b.getY(), b.previous.getX(), b.previous.getY()) != 0
+ // this call is expensive so do it last
+ && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false;
}
/** Determine whether the polygon defined between node start and node end is CW */