You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "TaiJuWu (via GitHub)" <gi...@apache.org> on 2024/06/23 08:30:55 UTC
Re: [PR] KAFKA-17023: add PCollectionsImmutableMap to ConcurrentMapBenchmark [kafka]
TaiJuWu commented on code in PR #16425:
URL: https://github.com/apache/kafka/pull/16425#discussion_r1650015837
##########
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/util/ConcurrentMapBenchmark.java:
##########
@@ -189,4 +194,60 @@ public void testCopyOnWriteMapEntrySet(Blackhole blackhole) {
}
}
}
+
+ @Benchmark
+ @OperationsPerInvocation(TIMES)
+ public void testPCollectionsImmutableMapGet(Blackhole blackhole) {
+ for (int i = 0; i < TIMES; i++) {
+ if (i % writePerLoops == 0) {
+ // add offset mapSize to ensure computeIfAbsent do add new entry
+ pcollectionsImmutableMap = pcollectionsImmutableMap.updated(i + mapSize, 0);
Review Comment:
This method is not thread-safe, we can check the result by add `assertEquals(10000, pcollectionsImmutableMap.size());` to verify.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org