Apache Lucene open-source search software
Use TernaryLongHeap in UpdateGraphsUtils.computeJoinSet() (#16153)
Prithvi Sca26239b3397
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex bc49af53e04..ec542061d6f 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -379,6 +379,8 @@ ImprovementsOptimizations---------------------+* GITHUB#16153: Use TernaryLongHeap in UpdateGraphsUtils for faster HNSW graph merging. (Prithvi S)+* GITHUB#15861: Optimise PhraseScorer by short circuiting non competitive documents in TOP_SCORES mode. (Prithvi S)* GITHUB#16154: Use Lucene's PriorityQueue in NearestNeighbor to avoid poll/offer overhead on the hot path. (Prithvi S)diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.javaindex 667ba37b7e3..ce103952d50 100644--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java@@ -21,7 +21,7 @@ import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;import java.io.IOException;import org.apache.lucene.internal.hppc.IntHashSet;-import org.apache.lucene.util.LongHeap;+import org.apache.lucene.util.TernaryLongHeap;/*** Utility class for updating a big graph with smaller graphs. This is used during merging of@@ -41,7 +41,7 @@ public class UpdateGraphsUtils {public static IntHashSet computeJoinSet(HnswGraph graph) throws IOException {int k; // coverage for the current nodeint size = graph.size();- LongHeap heap = new LongHeap(size);+ TernaryLongHeap heap = new TernaryLongHeap(size);IntHashSet j = new IntHashSet();boolean[] stale = new boolean[size];short[] counts = new short[size];