renatoh commented on PR #15682:
URL: https://github.com/apache/lucene/pull/15682#issuecomment-3872349971

   > I don't know that code specifically. LinkedList as a replacement for 
ArrayDeque is fine if the size of your queue is generally small and you add or 
remove items not too often. In that case it uses less memory and performance is 
not bad. But misusing LinkedList also for positional access (like some code 
does/did) should be fixed in all cases. Thanks for reminding about this old 
code.
   > 
   > I am still not sure why DocumentsWriterFlushControl uses LinkedList.... 
That code is not too old. Maybe it si really because of small sizes and memory 
pressure?
   
   It is pretty old
   org.apache.lucene.index.DocumentsWriterFlushControl#blockedFlushes is from 
its initial implementation back in 2011.
   If it used as a Queue like here, then I do not see any benefits of a 
LinkedList over an ArrayDeque, even with small Lists, or do I miss anything? 
LinkedList uses more memory due to its pointer and has, as far as I know, a 
very nich use case, the use case where most of the inserts/delets happens in 
the middle. If that is not the case and you do need access via index, ArrayList 
is better. If you use it as a Queue, ArrayDeque is the better option.


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