AndrewJSchofield commented on code in PR #20752:
URL: https://github.com/apache/kafka/pull/20752#discussion_r2455965933
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareCompletedFetch.java:
##########
@@ -99,10 +99,17 @@ public class ShareCompletedFetch {
}
private List<OffsetAndDeliveryCount>
buildAcquiredRecordList(List<ShareFetchResponseData.AcquiredRecords>
partitionAcquiredRecords) {
- List<OffsetAndDeliveryCount> acquiredRecordList = new LinkedList<>();
+ List<OffsetAndDeliveryCount> acquiredRecordList = new ArrayList<>();
Review Comment:
By default, a new list will have space for 10 elements. Resizing is
expensive. Maybe one optimisation would be to see how many offsets are in the
first element in the `partitionAcquiredRecords`, and using that number as the
initial size of the list. In the case of only one batch of offsets, the list
will be the correct size alrready. wdyt?
--
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]