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

Add PartialEq shortcut for ptr_eq strings #67

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

Swatinem
Copy link
Contributor

This first compares the Repr before falling back to actually comparing the raw as_str itself. In some micro-benchmarks, this speeds up inline and heap string comparisons when equal by ~70%.

There is a tiny hit in the non-equal case however. It is also noteworthy that the assembly generated for Repr is horrible, and looks like its above the inlining threshold now.

src/lib.rs Outdated Show resolved Hide resolved
This first compares the `Repr` before falling back to actually comparing the raw `as_str` itself.
In some micro-benchmarks, this speeds up inline and heap string comparisons when equal by ~70%.

There is a tiny hit in the non-equal case however. It is also noteworthy that the assembly generated for `Repr` is horrible,
and looks like its above the inlining threshold now.
@Veykril
Copy link
Member

Veykril commented Feb 8, 2024

Thanks!

@Veykril Veykril merged commit 9971a3f into rust-analyzer:master Feb 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants