Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tessellator performance by delaying calls to the method #isIntersectingPolygon #11786

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions lucene/core/src/java/org/apache/lucene/geo/Tessellator.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ private static final Node cureLocalIntersections(

// 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(),
Expand All @@ -783,7 +782,9 @@ && linesIntersect(
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)
Expand Down Expand Up @@ -1117,7 +1118,6 @@ private static final boolean isValidDiagonal(final Node a, final Node b) {
}
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)
Expand All @@ -1127,7 +1127,9 @@ && middleInsert(a, a.getX(), a.getY(), b.getX(), b.getY())
&& 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 */
Expand Down