iprithv commented on code in PR #15978:
URL: https://github.com/apache/lucene/pull/15978#discussion_r3139852308


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -205,15 +205,27 @@ protected void addVectors(int minOrd, int maxOrd) throws 
IOException {
       throw new IllegalStateException("This HnswGraphBuilder is frozen and 
cannot be updated");
     }
     long start = System.nanoTime(), t = start;
-    if (infoStream.isEnabled(HNSW_COMPONENT)) {
-      infoStream.message(HNSW_COMPONENT, "addVectors [" + minOrd + " " + 
maxOrd + ")");
-    }
+    int numVectors = maxOrd - minOrd;
     for (int node = minOrd; node < maxOrd; node++) {
       addGraphNode(node);
-      if ((node % 10000 == 0) && infoStream.isEnabled(HNSW_COMPONENT)) {
+      // Skip in-loop progress for ranges <= 10000 where it would fire at most 
once
+      // with identical incremental/total times (#15967).
+      if (numVectors > 10000 && (node % 10000 == 0) && 
infoStream.isEnabled(HNSW_COMPONENT)) {
         t = printGraphBuildStatus(node, start, t);
       }
     }
+    if (infoStream.isEnabled(HNSW_COMPONENT)) {
+      long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
+      infoStream.message(
+          HNSW_COMPONENT,
+          String.format(
+              Locale.ROOT,
+              "addVectors [%d %d): %d vectors in %d ms",

Review Comment:
   Yes, with SIMD-optimized vector operations, individual chunks could well 
complete in sub-millisecond times. Updated both printGraphBuildStatus and the 
per chunk completion message to use %.2f with nanoTime / 1_000_000.0 for proper 
sub-millisecond precision. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to