You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2022/11/23 23:52:33 UTC
[lucene] 17/19: More work related to 11965: Improve performance of nearestDistance queries somewhat by removing unnecessary code.
This is an automated email from the ASF dual-hosted git repository.
kwright pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit df377f94e7d6a6f8866cc692d0d16cb1c7ae9e60
Author: Karl David Wright <kw...@apache.org>
AuthorDate: Wed Nov 23 12:21:38 2022 -0500
More work related to 11965: Improve performance of nearestDistance queries somewhat by removing unnecessary code.
---
.../lucene/spatial3d/geom/GeoStandardPath.java | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
index 225c5978b43..ac6d61573b5 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
@@ -672,9 +672,10 @@ class GeoStandardPath extends GeoBasePath {
@Override
public DistancePair nearestDistance(
final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- if (!isWithinSection(x, y, z)) {
- return null;
- }
+ // Since there's no early-out for sections, this has no benefit and is actually a drawback
+ // if (!isWithinSection(x, y, z)) {
+ // return null;
+ // }
final DistancePair firstChildDistance = child1.nearestDistance(distanceStyle, x, y, z);
final DistancePair secondChildDistance = child2.nearestDistance(distanceStyle, x, y, z);
@@ -729,9 +730,10 @@ class GeoStandardPath extends GeoBasePath {
@Override
public double nearestPathDistance(
final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- if (!isWithinSection(x, y, z)) {
- return Double.POSITIVE_INFINITY;
- }
+ // No benefit, actually a drawback
+ // if (!isWithinSection(x, y, z)) {
+ // return Double.POSITIVE_INFINITY;
+ // }
return Math.min(
child1.nearestPathDistance(distanceStyle, x, y, z),
child2.nearestPathDistance(distanceStyle, x, y, z));
@@ -740,9 +742,10 @@ class GeoStandardPath extends GeoBasePath {
@Override
public double pathCenterDistance(
final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- if (!isWithinSection(x, y, z)) {
- return Double.POSITIVE_INFINITY;
- }
+ // No benefit, actually a drawback
+ // if (!isWithinSection(x, y, z)) {
+ // return Double.POSITIVE_INFINITY;
+ // }
return Math.min(
child1.pathCenterDistance(distanceStyle, x, y, z),
child2.pathCenterDistance(distanceStyle, x, y, z));