adixitconfluent commented on code in PR #17539:
URL: https://github.com/apache/kafka/pull/17539#discussion_r1830454251
##########
core/src/main/java/kafka/server/share/SharePartitionManager.java:
##########
@@ -574,6 +575,7 @@ void processShareFetch(ShareFetchData shareFetchData) {
// Initialize lazily, if required.
Map<TopicIdPartition, Throwable> erroneous = null;
Set<DelayedShareFetchKey> delayedShareFetchWatchKeys = new HashSet<>();
+ Map<TopicIdPartition, SharePartition> sharePartitions = new
LinkedHashMap<>();
Review Comment:
Hi Jun, reading online regarding the performance of LinkedHashMap and
HashMap - Linkedhashmap offers better performance when iterating through
elements since they maintain an ordered entry list, while a Hashmap offers
better performance when accessing large datasets. Furthermore, when storing
objects, Linkedhashmap stores objects in key-value pairs, while Hashmap stores
them in hash table. The type of key used also affects performance.
Since now we are iterating over `sharePartitions` within the function
`acquirablePartitions`, I thought it would be more efficient to use
LinkedHashMap over HashMap.
--
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]