From d838d8e3adedb425d604aee89e3b7107fcfa70b4 Mon Sep 17 00:00:00 2001 From: DoomDuck Date: Mon, 29 Jan 2024 12:23:16 +0100 Subject: image::Bytes::PartialEq: use core::ptr::eq to speed up comparison --- core/src/image.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/src/image.rs') diff --git a/core/src/image.rs b/core/src/image.rs index e9675316..e5fdcd83 100644 --- a/core/src/image.rs +++ b/core/src/image.rs @@ -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 } } -- cgit