jolshan opened a new pull request #11576:
URL: https://github.com/apache/kafka/pull/11576


   We are creating a new map unnecessarily for these methods. Remove the extra 
map creation and simply wrap in unmodifiable map. 
   
   I've also added a benchmark for the map method. 
   Here are some results when I limited partitions to 20 only. 
   
   Before change:
   ```
   Benchmark                                 (partitionCount)  (topicCount)  
Mode  Cnt   Score   Error  Units
   MetadataRequestBenchmark.testTopicIdInfo                20           500  
avgt   15  16.942 ± 0.306  ns/op
   MetadataRequestBenchmark.testTopicIdInfo                20          1000  
avgt   15  19.476 ± 0.339  ns/op
   MetadataRequestBenchmark.testTopicIdInfo                20          5000  
avgt   15  18.989 ± 0.482  ns/op
   ```
   
   After change:
   ```
   Benchmark                                 (partitionCount)  (topicCount)  
Mode  Cnt   Score   Error  Units
   MetadataRequestBenchmark.testTopicIdInfo                20           500  
avgt   15  11.120 ± 0.336  ns/op
   MetadataRequestBenchmark.testTopicIdInfo                20          1000  
avgt   15  11.173 ± 0.489  ns/op
   MetadataRequestBenchmark.testTopicIdInfo                20          5000  
avgt   15  11.003 ± 0.042  ns/op
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to