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 17:23:27 UTC
[lucene] branch main updated: 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 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 482f8251ff6 More work related to 11965: Improve performance of nearestDistance queries somewhat by removing unnecessary code.
482f8251ff6 is described below
commit 482f8251ff67be0620e46cba22751faf01d7b997
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 1a48441a389..4dd375873ac 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
@@ -671,9 +671,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);
@@ -728,9 +729,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));
@@ -739,9 +741,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));