You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by be...@apache.org on 2026/06/01 21:47:26 UTC

(lucene) branch branch_10x updated: Use TernaryLongHeap in UpdateGraphsUtils.computeJoinSet() (#16153)

This is an automated email from the ASF dual-hosted git repository.

benwtrent pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new 9cc683cf4df Use TernaryLongHeap in UpdateGraphsUtils.computeJoinSet() (#16153)
9cc683cf4df is described below

commit 9cc683cf4dff9c7f01dbf8999dbc1afc221b6fdf
Author: Prithvi S <pr...@gmail.com>
AuthorDate: Tue Jun 2 01:18:58 2026 +0530

    Use TernaryLongHeap in UpdateGraphsUtils.computeJoinSet() (#16153)
---
 lucene/CHANGES.txt                                                    | 2 ++
 .../core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java  | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 1758a858b51..6a58552a821 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -120,6 +120,8 @@ Optimizations
 * GITHUB#16050: Add SIMD-accelerated bulk range evaluation for dense numeric doc values via
   BatchDocValuesRangeIterator and DocValuesRangeSupport. (Sagar Upadhyaya)
 
+* 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.java
index 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 node
     int 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];