You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/12/08 22:37:04 UTC

[GitHub] [kafka] ijuma commented on pull request #12967: MINOR: Replace ArrayBuffer with ListBuffer for better performance

ijuma commented on PR #12967:
URL: https://github.com/apache/kafka/pull/12967#issuecomment-1343464276

   > The data structure is converted to Java's List from scala.
   
   Why is this? Java's `ArrayList` is array backed, just like `ArrayBuffer` while `ListBuffer` is a linked list.
   
   Generally, linked lists are worse due to cache effects and `ArrayBuffer` has amoritzed constant append too.
   
   One case where `ListBuffer` is better is when `ArrayBuffer` usage results in unnecessary allocations (i.e. small lists). A simple way of solving that for `ArrayBuffer` is to size the underlying array to be smaller.
   
   I haven't looked at the results in detail yet, but I wanted to share this as I am a bit confused about the PR description.


-- 
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: jira-unsubscribe@kafka.apache.org

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