You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/14 13:14:23 UTC

[GitHub] [pulsar] Jason918 commented on a change in pull request #14679: [Performance] Optimize comparisons by replacing ComparisonChain in hotspots

Jason918 commented on a change in pull request #14679:
URL: https://github.com/apache/pulsar/pull/14679#discussion_r825930957



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryImpl.java
##########
@@ -149,7 +148,15 @@ public long getEntryId() {
 
     @Override
     public int compareTo(EntryImpl other) {
-        return ComparisonChain.start().compare(ledgerId, other.ledgerId).compare(entryId, other.entryId).result();
+        if (this.ledgerId != other.ledgerId) {
+            return this.ledgerId < other.ledgerId ? -1 : 1;

Review comment:
       `java.lang.Long#compare(this.ledgerId, other.ledgerId)` is more readable.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org