gortiz commented on PR #12783:
URL: https://github.com/apache/pinot/pull/12783#issuecomment-2037670605

   > Are you aware of any tools that can be used to test cache improvements ?
   
   We can easily create a JMH benchmark that tests list vs array list in this 
kind of code. I think it is not worth to create a JMH benchmark that test the 
operator itself because it would be quite complex. 
   
   I'm not aware of other tools, but each linked list node contains a reference 
to its value and a reference to the next node in the link. That means we need 
at least 8 bytes (assuming compressed pointers) for each node. In theory these 
nodes may be spread in the heap, although my experience tell me that they are 
almost always to be one after the other in the heap because we allocate them by 
the same thread with no allocations in the middle. Future GCs may move them, 
but sounds pretty unlikely.
   
   While LinkedList requires 8 bytes per element that will probably but not for 
sure be contiguous in memory,  Array list requires just 4 bytes per element 
that are going to be contiguous in memory for sure. Therefore cache usage is 
always better with ArrayList than with LinkedList.


-- 
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: commits-unsubscr...@pinot.apache.org

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


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

Reply via email to