jbellis commented on code in PR #12421:
URL: https://github.com/apache/lucene/pull/12421#discussion_r1290379055


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:
##########
@@ -104,7 +103,9 @@ public void addNode(int level, int node) {
       // and make this node the graph's new entry point
       if (level >= numLevels) {
         for (int i = numLevels; i <= level; i++) {
-          graphUpperLevels.add(new HashMap<>());
+          graphUpperLevels.add(
+              new HashMap<>(
+                  16, levelLoadFactor)); // these are the default parameters, 
made explicit
         }

Review Comment:
   We specify the loadFactor because it's necessary to compute ram usage, and 
you can't retrieve the loadFactor once the Map is constructed.  
   
   The 16 is there because before it was just saying new HashMap() and I can't 
specify the loadFactor w/o also specifying the initialCapacity.  As the comment 
indicates, 16 is the default initialCapacity.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to