image::Bytes::PartialEq: use core::ptr::eq to speed up comparison

This commit is contained in:
DoomDuck 2024-01-29 12:23:16 +01:00 committed by Héctor Ramón Jiménez
parent 80a29a277e
commit d838d8e3ad
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -112,7 +112,9 @@ impl std::hash::Hash for Bytes {
impl PartialEq for Bytes {
fn eq(&self, other: &Self) -> bool {
self.as_ref() == other.as_ref()
let a = self.as_ref();
let b = other.as_ref();
core::ptr::eq(a, b) || a == b
}
}