Skip to content

Neon fast path for str::contains#152176

Open
JamieCunliffe wants to merge 1 commit intorust-lang:mainfrom
JamieCunliffe:neon-str-contains
Open

Neon fast path for str::contains#152176
JamieCunliffe wants to merge 1 commit intorust-lang:mainfrom
JamieCunliffe:neon-str-contains

Conversation

@JamieCunliffe
Copy link
Contributor

Using the SIMD friendly version of the function also gives a decent speed up with Neon.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@jhpratt
Copy link
Member

jhpratt commented Feb 7, 2026

I can't vouch for correctness.

@rustbot reroll

@rustbot rustbot assigned Mark-Simulacrum and unassigned jhpratt Feb 7, 2026
@Mark-Simulacrum
Copy link
Member

decent speed up with Neon.

How do you know? Did we run benchmarks (can you provide the results)?

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 8, 2026
@JamieCunliffe
Copy link
Contributor Author

I didn't see any benchmarks for this in tree but I did write a few quick ones, something such as:

let data = "Lorem ipsum dolor sit amet";
c.bench_function("amet", |b| b.iter(|| black_box("amet".is_contained_in(&data))));

Nightly: [41.489 ns 41.512 ns 41.534 ns]
This change: [10.610 ns 10.611 ns 10.613 ns]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants