diff options
author | 2024-02-07 20:39:39 +0100 | |
---|---|---|
committer | 2024-02-07 20:39:39 +0100 | |
commit | 5630febf963ffcdd9eb1e0e8581a65a08d501467 (patch) | |
tree | aef084d40768ef369f2419b88dc4ad3ac6d305a3 | |
parent | 80081f0f1c00d9dc94d3ed24dd37ab5285cff0db (diff) | |
parent | d6aea096468edc618b4b5972dd39daded55a9eb0 (diff) | |
download | iced-5630febf963ffcdd9eb1e0e8581a65a08d501467.tar.gz iced-5630febf963ffcdd9eb1e0e8581a65a08d501467.tar.bz2 iced-5630febf963ffcdd9eb1e0e8581a65a08d501467.zip |
Merge pull request #2220 from DoomDuck/faster_image_bytes_handle
Use `core::ptr::eq` to speed up `PartialEq` on `image::Bytes`
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | core/src/image.rs | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d28c45c..fb9afe47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Assert dimensions of quads are normal in `iced_tiny_skia`. [#2082](https://github.com/iced-rs/iced/pull/2082) - Remove `position` from `overlay::Element`. [#2226](https://github.com/iced-rs/iced/pull/2226) - Add a capacity limit to the `GlyphCache` in `iced_tiny_skia`. [#2210](https://github.com/iced-rs/iced/pull/2210) +- Use pointer equality to speed up `PartialEq` implementation of `image::Bytes`. [#2220](https://github.com/iced-rs/iced/pull/2220) ### Fixed - Clipping of `TextInput` selection. [#2199](https://github.com/iced-rs/iced/pull/2199) @@ -115,6 +116,7 @@ Many thanks to... - @Davidster - @Decodetalkers - @derezzedex +- @DoomDuck - @dtzxporter - @fogarecious - @GyulyVGC 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 } } |