Optimize path components iteration on platforms that don't have prefixes by the8472 · Pull Request #148084 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits3 Checks11 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@the8472

OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49

@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

Oct 24, 2025

@rustbot

r? @Mark-Simulacrum

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

@Kobzol

Nice! I was thinking about this when profiling rust-lang/glob#181, because it was clear that getting just the filename is unnecessary slow just becase .components() has to be called.

@rustbot

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@the8472

it was clear that getting just the filename is unnecessary slow just becase .components() has to be called.

added a benchmark for getting filenames

@Mark-Simulacrum

@bors

📌 Commit d263ab3 has been approved by Mark-Simulacrum

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

Nov 8, 2025

bors added a commit that referenced this pull request

Nov 9, 2025

@bors

Rollup of 22 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit that referenced this pull request

Nov 9, 2025

@rust-timer

Rollup merge of #148084 - the8472:prefixless-path-components-iter, r=Mark-Simulacrum

Optimize path components iteration on platforms that don't have prefixes

OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49

github-actions bot pushed a commit to rust-lang/stdarch that referenced this pull request

Nov 10, 2025

@bors

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Nov 10, 2025

@bors

makai410 pushed a commit to makai410/rustc_public that referenced this pull request

Nov 10, 2025

@bors

makai410 pushed a commit to makai410/rust that referenced this pull request

Nov 10, 2025

@Zalathar

…-iter, r=Mark-Simulacrum

Optimize path components iteration on platforms that don't have prefixes

OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49

makai410 pushed a commit to makai410/rust that referenced this pull request

Nov 10, 2025

@bors

@Zalathar

This PR appears to have triggered the perf regressions observed in rollup at #148721 (comment).

@the8472

rust-lang/glob#181 (comment) shows some improvements at runtime.
Binary sizes are down.
One of the compile-time regressions is in cargo which works a lot with paths, so that's not very surprising.
Linker wall-time for cargo-opt-full more than doubling is surprising to me though.

makai410 pushed a commit to makai410/rustc_public that referenced this pull request

Nov 16, 2025

@bors

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request

Nov 30, 2025

@Zalathar

…-iter, r=Mark-Simulacrum

Optimize path components iteration on platforms that don't have prefixes

OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request

Nov 30, 2025

@bors

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.