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 File constructors that return files wrapped with a buffer #130803

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Sep 24, 2024

In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers.

ACP: rust-lang/libs-team#446
Tracking Issue: #130804

@cuviper cuviper added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2024

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
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 A-rustdoc-json Area: Rustdoc JSON backend O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cuviper cuviper added A-filesystem Area: `std::fs` and removed O-unix Operating system: Unix-like A-rustdoc-json Area: Rustdoc JSON backend labels Sep 24, 2024
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 25, 2024

📌 Commit 458537e has been approved by joshtriplett

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 Sep 25, 2024
@bors
Copy link
Contributor

bors commented Sep 25, 2024

⌛ Testing commit 458537e with merge 4c62024...

@bors
Copy link
Contributor

bors commented Sep 25, 2024

☀️ Test successful - checks-actions
Approved by: joshtriplett
Pushing 4c62024 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 25, 2024
@bors bors merged commit 4c62024 into rust-lang:master Sep 25, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 25, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4c62024): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.4% [1.3%, 1.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary 0.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.5%, 1.1%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.5%, 1.1%] 5

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 769.688s -> 771.199s (0.20%)
Artifact size: 340.87 MiB -> 340.88 MiB (0.00%)

@cuviper cuviper deleted the file-buffered branch September 27, 2024 01:16
/// # Errors
///
/// This function will return an error if `path` does not already exist.
/// Other errors may also be returned according to [`OpenOptions::open`].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems incomplete, since it can also return an error from try_new_buffer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, see #131462.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-filesystem Area: `std::fs` merged-by-bors This PR was explicitly merged by bors. 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.

7 participants