Skip to content

speed up charsearcher for ascii chars #141516

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

Merged
merged 1 commit into from
May 26, 2025
Merged

speed up charsearcher for ascii chars #141516

merged 1 commit into from
May 26, 2025

Conversation

bend-n
Copy link
Contributor

@bend-n bend-n commented May 24, 2025

attempt at fixing #82471

this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters

im not completely sure that this is always an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 24, 2025
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member

I do not expect changing this library API to significantly affect the speed of rustc compiling code, so I do not think a perf run is relevant.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bend-n
Copy link
Contributor Author

bend-n commented May 25, 2025

this takes the mentioned benchmark from

Time elapsed in splitn is: 2.04s
Time elapsed in iter() rposition is: 435.90ms

to

Time elapsed in splitn is: 425.42ms
Time elapsed in iter() rposition is: 454.41ms

@bend-n bend-n force-pushed the okay branch 3 times, most recently from ddd1892 to a356e45 Compare May 25, 2025 15:58
@bend-n bend-n marked this pull request as ready for review May 25, 2025 17:20
@rustbot
Copy link
Collaborator

rustbot commented May 25, 2025

r? @workingjubilee

rustbot has assigned @workingjubilee.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2025
@bend-n bend-n changed the title an attempt speed up charsearcher for ascii chars May 25, 2025
@workingjubilee
Copy link
Member

awesome. easy win and much nicer code than the first version. squash?

@bend-n bend-n force-pushed the okay branch 4 times, most recently from 275e9dd to be63840 Compare May 25, 2025 18:39
@workingjubilee
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 25, 2025

📌 Commit 245bf50 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 25, 2025
@workingjubilee
Copy link
Member

Thanks!

bors added a commit that referenced this pull request May 26, 2025
Rollup of 10 pull requests

Successful merges:

 - #140898 (minor improvements on running miri)
 - #141392 (Avoid obligation construction dance with query region constraints)
 - #141431 (Emit dummy open drop for unsafe binder)
 - #141433 (Properly analyze captures from unsafe binders)
 - #141439 (Deduplicate dyn compatibility violations due to coercion)
 - #141449 (further deduplicate ast visitor code)
 - #141513 (interpret: add allocation parameters to `AllocBytes`)
 - #141516 (speed up charsearcher for ascii chars)
 - #141526 (add a dedicated section for compiler environment variables in the unstable book)
 - #141550 (Fix `unused_braces` lint suggestion when encountering attributes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 408dc51 into rust-lang:master May 26, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 26, 2025
rust-timer added a commit that referenced this pull request May 26, 2025
Rollup merge of #141516 - bend-n:okay, r=workingjubilee

speed up charsearcher for ascii chars

attempt at fixing #82471

this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters

im not completely sure that this is _always_ an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases
@bend-n bend-n deleted the okay branch May 27, 2025 03:33
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 27, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#140898 (minor improvements on running miri)
 - rust-lang/rust#141392 (Avoid obligation construction dance with query region constraints)
 - rust-lang/rust#141431 (Emit dummy open drop for unsafe binder)
 - rust-lang/rust#141433 (Properly analyze captures from unsafe binders)
 - rust-lang/rust#141439 (Deduplicate dyn compatibility violations due to coercion)
 - rust-lang/rust#141449 (further deduplicate ast visitor code)
 - rust-lang/rust#141513 (interpret: add allocation parameters to `AllocBytes`)
 - rust-lang/rust#141516 (speed up charsearcher for ascii chars)
 - rust-lang/rust#141526 (add a dedicated section for compiler environment variables in the unstable book)
 - rust-lang/rust#141550 (Fix `unused_braces` lint suggestion when encountering attributes)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants