wang-jiahua commented on PR #10485:
URL: https://github.com/apache/rocketmq/pull/10485#issuecomment-4842197649

   Closing this PR. Micro-benchmark shows the CodeAdderPair volatile cache 
introduces a 14x regression under multi-threaded (8 EventLoop) access:
   
   | Scenario | Original (computeIfAbsent) | Cached (CodeAdderPair) |
   |----------|:---:|:---:|
   | Single-thread | 11.20 ns/op | 7.59 ns/op (1.5x faster) |
   | 8 threads | 2.00 ns/op | 27.74 ns/op (14x slower) |
   
   The volatile write on cache miss causes cache line invalidation across 
cores, and object allocation increases GC pressure. JDK 21's 
ConcurrentHashMap.computeIfAbsent is near-lock-free for read-heavy workloads, 
making the original code already optimal.
   
   Thanks @RongtongJin for the review feedback.


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