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

Avoid copies while creating the metadata object file #89980

Closed
wants to merge 4 commits into from

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Oct 17, 2021

This is now possible thanks to gimli-rs/object#369 and gimli-rs/object#370.

@bjorn3 bjorn3 added A-metadata Area: Crate metadata T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2021
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 17, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 17, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Oct 17, 2021

⌛ Trying commit e94f6d53199fb5057549a7ac40d6789234627853 with merge 004de1ed6e374e4d0b15f135c005f65181a65388...

@@ -4984,7 +4993,7 @@ dependencies = [
"hermit-abi",
"libc",
"miniz_oxide",
"object",
"object 0.26.2",
Copy link
Member

Choose a reason for hiding this comment

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

Consider updating this as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

The backtrace crate will need to be updated first. While object 0.27 is mostly compatible with 0.26 I don't want to risk it breaking due to the backtrace crate depending on 0.26, but libstd then giving it the 0.27 version.

@bors
Copy link
Contributor

bors commented Oct 17, 2021

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

@rust-timer
Copy link
Collaborator

Queued 004de1ed6e374e4d0b15f135c005f65181a65388 with parent 1d6f242, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (004de1ed6e374e4d0b15f135c005f65181a65388): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -0.7% on incr-unchanged builds of deeply-nested-async)
  • Small regression in instruction counts (up to 0.2% on incr-full builds of clap-rs)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 17, 2021
This avoids a clone of the section data
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 17, 2021

In the last commit I forgot to replace an occurrence of append_section_data with set_section_data causing this commit to only improve perf on windows and macos. Fixed it now.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Oct 17, 2021

⌛ Trying commit 2e42950 with merge 1d2e2ee78a3c9f24af580e6d95c9ee90ff366a43...

@bors
Copy link
Contributor

bors commented Oct 17, 2021

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

@rust-timer
Copy link
Collaborator

Queued 1d2e2ee78a3c9f24af580e6d95c9ee90ff366a43 with parent 6f53ddf, future comparison URL.

file
};
let out_file = match fs::File::create(out_filename) {
Ok(out_file) => io::BufWriter::new(out_file),
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be an Result::and_then() chain? to deduplicate the error messages... or are the messages going to be "improved" somehow to be being different?

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1d2e2ee78a3c9f24af580e6d95c9ee90ff366a43): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -0.7% on incr-unchanged builds of deeply-nested-async)
  • Small regression in instruction counts (up to 0.6% on incr-full builds of ctfe-stress-4)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 17, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 25, 2021

Let's try only the set_section_data change and not using write_stream.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Oct 25, 2021

⌛ Trying commit a3a8a2b with merge 2129c06d54db38da7d32318e20dd5b9b4bedf6b9...

@bors
Copy link
Contributor

bors commented Oct 25, 2021

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

@rust-timer
Copy link
Collaborator

Queued 2129c06d54db38da7d32318e20dd5b9b4bedf6b9 with parent 56694b0, future comparison URL.

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Contributor

bors commented Oct 25, 2021

⌛ Trying commit a3a8a2b with merge 3342d61e41045577b63c09dc68e4d2385b8a8e6e...

@bors
Copy link
Contributor

bors commented Oct 25, 2021

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

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 29, 2021

@rust-timer check 3342d61e41045577b63c09dc68e4d2385b8a8e6e

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 29, 2021

@rust-timer build 3342d61e41045577b63c09dc68e4d2385b8a8e6e

@rust-timer
Copy link
Collaborator

Queued 3342d61e41045577b63c09dc68e4d2385b8a8e6e with parent 84c2a85, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3342d61e41045577b63c09dc68e4d2385b8a8e6e): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Oct 29, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 29, 2021

set_section_data without write_stream is a small improvement on average it seems, but very close to noise.

@nagisa
Copy link
Member

nagisa commented Nov 12, 2021

@bjorn3 do you think we should still land this despite no significant performance improvements? The changes seem non-intrusive enough that I'm happy to see this landing either way. (r=me, your call if you want to land this or not)

@bjorn3
Copy link
Member Author

bjorn3 commented Nov 12, 2021

I think it is worth it. It should wait for backtrace-rs to update it's object dependency first to avoid multiple versions of object being used I think.

@nagisa nagisa added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2021
@bjorn3 bjorn3 closed this Feb 12, 2022
@bjorn3 bjorn3 deleted the faster_metadata_writing branch February 12, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. 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.

None yet

8 participants