Skip to content

Commit

Permalink
fix: 278: Improve Bytes.equals() performance (#282)
Browse files Browse the repository at this point in the history
Fixes: #278
Reviewed-by: Alex Kuzmin <alex.kuzmin@swirldslabs.com>, Ivan Malygin <ivan@swirldslabs.com>
Signed-off-by: Artem Ananev <artem.ananev@swirldslabs.com>
  • Loading branch information
artemananiev authored Sep 4, 2024
1 parent c9b0330 commit 223a232
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pbj-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Version number
version=0.9.3-SNAPSHOT
version=0.9.4-SNAPSHOT

# Need increased heap for running Gradle itself, or SonarQube will run the JVM out of metaspace
org.gradle.jvmargs=-Xmx2048m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,7 @@ public String toHex() {
public boolean equals(@Nullable final Object o) {
if (this == o) return true;
if (!(o instanceof Bytes that)) return false;
if (length != that.length()) {
return false;
}
if (length == 0) return true;
for (int i = 0; i < length; i++) {
if (getByte(i) != that.getByte(i)) {
return false;
}
}
return true;
return Arrays.equals(buffer, start, start + length, that.buffer, that.start, that.start + that.length);
}

/**
Expand Down

0 comments on commit 223a232

Please sign in to comment.