Skip to content

Use core::ptr::eq to speed up PartialEq on image::Bytes#2220

Merged
hecrj merged 2 commits intoiced-rs:masterfrom
DoomDuck:faster_image_bytes_handle
Feb 7, 2024
Merged

Use core::ptr::eq to speed up PartialEq on image::Bytes#2220
hecrj merged 2 commits intoiced-rs:masterfrom
DoomDuck:faster_image_bytes_handle

Conversation

@DoomDuck
Copy link
Contributor

Why

When loading images from memory iced takes a long time comparing image::Handles.
To improve its speed using core::ptr::eq checks if the slices are identical both the start pointer and the length.

Effectiveness

I have not seen the optimization happen in either the standard library nor the results given by the compiler.
I also think I have seen the cost of image::Handle's comparison in some perf data.

@hecrj hecrj added this to the 0.12 milestone Feb 7, 2024
@hecrj hecrj added improvement An internal improvement performance image labels Feb 7, 2024
@hecrj hecrj force-pushed the faster_image_bytes_handle branch from 0e2665d to d6aea09 Compare February 7, 2024 19:33
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Thanks 🥳

@hecrj hecrj enabled auto-merge February 7, 2024 19:33
@hecrj hecrj merged commit 5630feb into iced-rs:master Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image improvement An internal improvement performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments