Skip to content

Commit

Permalink
Merge pull request #2220 from DoomDuck/faster_image_bytes_handle
Browse files Browse the repository at this point in the history
Use `core::ptr::eq` to speed up `PartialEq` on `image::Bytes`
  • Loading branch information
hecrj authored Feb 7, 2024
2 parents 80081f0 + d6aea09 commit 5630feb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -115,6 +116,7 @@ Many thanks to...
- @Davidster
- @Decodetalkers
- @derezzedex
- @DoomDuck
- @dtzxporter
- @fogarecious
- @GyulyVGC
Expand Down
4 changes: 3 additions & 1 deletion core/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 5630feb

Please sign in to comment.