mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-08 20:47:59 -05:00
Improve equals performance on Address (#8013)
* Improve equals performance operation on Address * Use toArrayUnsafe instead of toArray to reduce GC overhead Signed-off-by: Ameziane H. <ameziane.hamlat@consensys.net> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import org.hyperledger.besu.ethereum.rlp.RLP;
|
||||
import org.hyperledger.besu.ethereum.rlp.RLPException;
|
||||
import org.hyperledger.besu.ethereum.rlp.RLPInput;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
@@ -291,4 +292,16 @@ public class Address extends DelegatingBytes {
|
||||
return Hash.hash(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Address)) {
|
||||
return false;
|
||||
}
|
||||
Address other = (Address) obj;
|
||||
return Arrays.equals(this.toArrayUnsafe(), other.toArrayUnsafe());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user