viswanathk commented on issue #14002:
URL: https://github.com/apache/lucene/issues/14002#issuecomment-2498525370

   > Interesting. The "theoretical" max depth of this stack would be the size 
of this graph. I suppose the stack does get large, which would explain a high 
no. of Array::grow calls? Would be interesting to see the impact of just 
setting initial capacity to half of the size of graph.
   
   Maybe `sqrt` might be a good start? On next grow it should be large enough, 
and is probably small enough starting point.
   
   > I do think it's worth improving. Another way could be to measure 
empirically the stack depth - maybe it scales in a predictable way with total 
number of vectors? And then we can use that prediction as an initial size. We 
could also think of using a primitive array that grows (implement our own 
primitive ArrayDeque).
   
   Should we be concerned about the chance of a humongous allocation (if the 
stack is really deep) with primitives? If not, I can give it a shot with 
running the same benchmarks with primitives and starting at `sqrt` of the graph 
size at that level. 


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