schlosna commented on PR #12782:
URL: https://github.com/apache/kafka/pull/12782#issuecomment-2278960075

   Added a JMH benchmark to exercise 
`org.apache.kafka.common.requests.MetadataResponse#toPartitionInfo` that calls 
`org.apache.kafka.common.requests.MetadataResponse#convertToNodeArray` 3 times 
per invocation -- for replica IDs, in-sync replica IDs, and offline replica 
IDs. This shows between ~20% and ~40% speedup varying by the number of nodes.
   
   
   VM version: JDK 17.0.11, OpenJDK 64-Bit Server VM, 17.0.11+9-LTS
   
   Before
   ```
   Benchmark                                  (nodes)  Mode  Cnt      Score     
Error  Units
   MetadataResponseBenchmark.toPartitionInfo       10  avgt    5    183.330 ±  
75.806  ns/op
   MetadataResponseBenchmark.toPartitionInfo      500  avgt    5   5418.979 ± 
154.885  ns/op
   MetadataResponseBenchmark.toPartitionInfo     1000  avgt    5  12207.096 ± 
647.602  ns/op
   ```
   
   After
   ```
   Benchmark                                  (nodes)  Mode  Cnt     Score     
Error  Units
   MetadataResponseBenchmark.toPartitionInfo       10  avgt    5   114.204 ±   
3.927  ns/op
   MetadataResponseBenchmark.toPartitionInfo      500  avgt    5  3871.721 ± 
176.063  ns/op
   MetadataResponseBenchmark.toPartitionInfo     1000  avgt    5  9625.442 ± 
581.124  ns/op
   ```


-- 
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]

Reply via email to