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

Fix the FileEncoder buffer size. #111088

Merged
merged 1 commit into from
May 15, 2023

Conversation

nnethercote
Copy link
Contributor

It allows a variable size, but in practice we always use the default of 8192 bytes. This commit fixes it to that size, which makes things slightly faster because the size can be hard-wired in generated code.

The commit also:

  • Rearranges some buffer capacity checks so they're all in the same form (x > BUFSIZE).
  • Removes some buffer capacity assertions and comments about them. With an 8192 byte buffer, we're not in any danger of overflowing a usize.

r? @WaffleLapkin

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2023
@nnethercote
Copy link
Contributor Author

This was a small (sub-1%) but widespread win for me locally, let's see what happens on CI.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 2, 2023
@bors
Copy link
Contributor

bors commented May 2, 2023

⌛ Trying commit 09b380f04475ad328ff3c525f6224384b1e3b6bc with merge e959c1c6134125cb2710dad9da572e29dca474ab...

@bors
Copy link
Contributor

bors commented May 2, 2023

☀️ Try build successful - checks-actions
Build commit: e959c1c6134125cb2710dad9da572e29dca474ab (e959c1c6134125cb2710dad9da572e29dca474ab)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e959c1c6134125cb2710dad9da572e29dca474ab): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -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)
- - 0
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 13
Improvements ✅
(secondary)
-0.4% [-0.7%, -0.2%] 7
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 13

Max RSS (memory usage)

Results

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-4.6%, -3.2%] 2
All ❌✅ (primary) - - 0

Cycles

Results

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
Regressions ❌
(secondary)
3.8% [2.8%, 4.6%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 655.55s -> 655.596s (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 2, 2023
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

r=me with the import nit.

compiler/rustc_serialize/src/opaque.rs Outdated Show resolved Hide resolved
compiler/rustc_serialize/src/opaque.rs Show resolved Hide resolved
@nnethercote
Copy link
Contributor Author

@bors r=WaffleLapkin

@bors
Copy link
Contributor

bors commented May 3, 2023

📌 Commit 8556960567f0406f850b501aba62798da46a9cc9 has been approved by WaffleLapkin

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 3, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

⌛ Testing commit 8556960567f0406f850b501aba62798da46a9cc9 with merge 83c5a15eb61ead6f4acebabce9a4c002855e4279...

@bors
Copy link
Contributor

bors commented May 5, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 5, 2023
@rust-log-analyzer

This comment has been minimized.

@lqd
Copy link
Member

lqd commented May 5, 2023

@bors retry

@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 5, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout fix-FileEncoder-buf-size (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self fix-FileEncoder-buf-size --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_serialize/src/opaque.rs
CONFLICT (content): Merge conflict in compiler/rustc_serialize/src/opaque.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 5, 2023
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 5, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

☔ The latest upstream changes (presumably #111231) made this pull request unmergeable. Please resolve the merge conflicts.

It allows a variable size, but in practice we always use the default of
8192 bytes. This commit fixes it to that size, which makes things
slightly faster because the size can be hard-wired in generated code.

The commit also:
- Rearranges some buffer capacity checks so they're all in the same form
  (`x > BUFSIZE`).
- Removes some buffer capacity assertions and comments about them. With
  an 8192 byte buffer, we're not in any danger of overflowing a `usize`.
@nnethercote
Copy link
Contributor Author

I rebased.

@bors r=WaffleLapkin

@bors
Copy link
Contributor

bors commented May 15, 2023

📌 Commit f2df861 has been approved by WaffleLapkin

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 15, 2023
@bors
Copy link
Contributor

bors commented May 15, 2023

⌛ Testing commit f2df861 with merge 8006510...

@bors
Copy link
Contributor

bors commented May 15, 2023

☀️ Test successful - checks-actions
Approved by: WaffleLapkin
Pushing 8006510 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 15, 2023
@bors bors merged commit 8006510 into rust-lang:master May 15, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 15, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8006510): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
-0.3% [-0.5%, -0.3%] 10
Improvements ✅
(secondary)
-0.4% [-0.7%, -0.2%] 12
All ❌✅ (primary) -0.3% [-0.5%, -0.3%] 10

Max RSS (memory usage)

Results

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)
4.7% [4.3%, 5.3%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) 4.7% [4.3%, 5.3%] 3

Cycles

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

Binary size

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

Bootstrap: 640.795s -> 641.463s (0.10%)

@rustbot rustbot added the perf-regression Performance regression. label May 15, 2023
@lqd
Copy link
Member

lqd commented May 15, 2023

This is a win overall, and the one regression looks like a return to steady-state after a noisy improvement in the preceding PR #108273 (comment)

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label May 15, 2023
@nnethercote nnethercote deleted the fix-FileEncoder-buf-size branch May 15, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler 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