zhaih commented on code in PR #12651:
URL: https://github.com/apache/lucene/pull/12651#discussion_r1357264961


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:
##########
@@ -40,31 +41,29 @@ public final class OnHeapHnswGraph extends HnswGraph 
implements Accountable {
   // to vectors
   // added to HnswBuilder, and the node values are the ordinals of those 
vectors.
   // Thus, on all levels, neighbors expressed as the level 0's nodes' ordinals.
-  private final List<NeighborArray> graphLevel0;

Review Comment:
   > Hmm that is interesting but since it will usually be sparse we will still 
have a lot of mutations to do
   
   That's not the case I think, we can always make the code to insert the 
up-most level of that node first such that we allocate the level for the node 
and never need to resize for the second dimension. And there'll be no waste of 
space on the second dimension because we allocate them according to need. See 
`OnHeapHnswGraph#addNode` I think that code explains itself.



-- 
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