-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
feat(std): Stabilize 'os_str_bytes' feature #115443
Merged
Merged
Conversation
This file contains 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
@rustbot modify labels: +T-libs-api |
rustbot
added
the
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
label
Sep 1, 2023
r? @cuviper (rustbot has picked a reviewer for you, use r? to override) |
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
Sep 1, 2023
This comment has been minimized.
This comment has been minimized.
The Miri subtree was changed cc @rust-lang/miri |
The FCP approval asked for a name change: #111544 (comment) |
Thanks, somehow I missed that |
rustbot
added
O-unix
Operating system: Unix-like
O-windows
Operating system: Windows
labels
Sep 2, 2023
This comment has been minimized.
This comment has been minimized.
@rustbot ready |
@bors r+ |
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
Sep 2, 2023
fmease
added a commit
to fmease/rust
that referenced
this pull request
Sep 2, 2023
feat(std): Stabilize 'os_str_bytes' feature Closes rust-lang#111544
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 2, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#114349 (rustc_llvm: Link to `zlib` on dragonfly and solaris) - rust-lang#114845 (Add alignment to the NPO guarantee) - rust-lang#115427 (kmc-solid: Fix `is_interrupted`) - rust-lang#115443 (feat(std): Stabilize 'os_str_bytes' feature) - rust-lang#115444 (Create a SMIR visitor) - rust-lang#115449 (Const-stabilize `is_ascii`) - rust-lang#115456 (Add spastorino on vacation) r? `@ghost` `@rustbot` modify labels: rollup
sunshowers
pushed a commit
to camino-rs/camino
that referenced
this pull request
Aug 15, 2024
Background: When I was migrating `PathBuf` to `Utf8PathBuf`, etc, I found out some regression in our benchmarks. Then I found out `as_str` is actually not cost-free as in the older version of rustc there's no way to get the underlying bytes out of an `OsStr` until 1.74.0. In this PR, with the help of [`OsStr::as_encoded_bytes`](rust-lang/rust#115443) was stabilized in 1.74.0, We can perform a cost-free conversion from `&OsStr` to `&str` with constraint of it's underlying bytes are `UTF-8` encoded. Benchmark: With the benchmark included in the PR, the time cost is a constant now. Result: ``` // String length of 10 osstr to_str/10 time: [5.9769 ns 5.9913 ns 6.0060 ns] osstr as_encoded_bytes/10 time: [554.90 ps 558.32 ps 562.19 ps] // String length of 100 osstr to_str/100 time: [6.6113 ns 6.6250 ns 6.6404 ns] osstr as_encoded_bytes/100 time: [553.18 ps 557.33 ps 561.68 ps] // String length of 1000 osstr to_str/1000 time: [26.990 ns 27.033 ns 27.086 ns] osstr as_encoded_bytes/1000 time: [553.66 ps 560.67 ps 570.42 ps] // String length of 10000 osstr to_str/10000 time: [310.17 ns 310.77 ns 311.32 ns] osstr as_encoded_bytes/10000 time: [550.98 ps 555.16 ps 559.53 ps] ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
O-unix
Operating system: Unix-like
O-windows
Operating system: Windows
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.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #111544