brandboat commented on PR #16231: URL: https://github.com/apache/kafka/pull/16231#issuecomment-2156132892
Modified a couple of things in the latest commit: 1. Add computeIfAbsent in each benchmark since in the code base we use both get and computeIfAbsent in CopyOnWriteMap, and we want to test the performance between CopyOnWriteMap & ConcurrentHashMap. 2. remove HashMap benchmark to avoid ConcurrentModificationException since we want to test get & computeIfAbsent. 3. Adding back % math operator to avoid unnecessary double for loop and the % I thought is not something that may mess up the benchmark result. The latest benchmark result is here (also modified the pr description). And it clearly showed out the performance of concurrentHashMap is better than CopyOnWriteMap. ``` Benchmark (mapSize) (times) (writePerLoops) Mode Cnt Score Error Units ConcurrentMapBenchmark.testConcurrentHashMap 100 1000000 10000 avgt 15 15046454.526 ± 39687.442 ns/op ConcurrentMapBenchmark.testCopyOnWriteMap 100 1000000 10000 avgt 15 236311312.944 ± 21788514.733 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org