thetumbled commented on code in PR #21107:
URL: https://github.com/apache/pulsar/pull/21107#discussion_r1313675137
##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMap.java:
##########
@@ -322,15 +324,15 @@ private static final class Section extends StampedLock {
LongPair get(long key1, long key2, int keyHash) {
long stamp = tryOptimisticRead();
boolean acquiredLock = false;
- int bucket = signSafeMod(keyHash, capacity);
+ int bucketIndex = signSafeMod(keyHash, capacity) * ITEM_SIZE;
Review Comment:
Change method name `signSafeMod` to `hash` may be better, right?
And i wonder whether the compiler will do such optimizations, could you
verify this? thanks.
IMO, these util class adopt some kind of ideas from common util class like
`HashMap`, which use `&` to avoid `%` too.
--
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]