Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 7, 2024

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
13 checks passed
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