2

rustc_metadata: Do not encode unnecessary module children by petrochenkov · Pull...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/95899
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

New issue

rustc_metadata: Do not encode unnecessary module children #95899

Conversation

Copy link

Contributor

@petrochenkov petrochenkov commented 12 days ago

This should remove the syntax context shift and the special case for ExternCrate in decoder in #95880.

This PR also shifts some work from decoding to encoding, which is typically useful for performance (but probably not much in this case).
r? @cjgillot

rustbot

added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label

12 days ago

rust-highfive

added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label

12 days ago

Copy link

Contributor

Author

petrochenkov commented 12 days ago

Copy link

Collaborator

rust-timer commented 12 days ago

Awaiting bors try build completion.

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

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

12 days ago

Copy link

Contributor

bors commented 12 days ago

hourglass Trying commit 36ba653 with merge ab97670...

Copy link

Contributor

bors commented 12 days ago

sunny Try build successful - checks-actions
Build commit: ab97670 (ab97670d6b187ca5c79ef1f034cb0cf847d414a0)

Copy link

Collaborator

rust-timer commented 12 days ago

Copy link

Collaborator

rust-timer commented 12 days ago

Finished benchmarking commit (ab97670): comparison url.

Summary:

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: tada relevant improvements found

Regressions crying_cat_face
(primary) Regressions crying_cat_face
(secondary) Improvements tada
(primary) Improvements tada
(secondary) All crying_cat_facetada
(primary)

count1 0 0 0 14 0

mean2 N/A N/A N/A -0.6% N/A

max N/A N/A N/A -1.4% N/A

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

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

Copy link

Contributor

Author

petrochenkov commented 11 days ago

Copy link

Collaborator

rust-timer commented 11 days ago

Awaiting bors try build completion.

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

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

11 days ago

Copy link

Contributor

bors commented 11 days ago

hourglass Trying commit 2500d5e with merge 375662f...

Copy link

Contributor

bors commented 11 days ago

sunny Try build successful - checks-actions
Build commit: 375662f (375662f24f455afd30df0f92c7fe92d4c168bbb8)

Copy link

Collaborator

rust-timer commented 11 days ago

Copy link

Collaborator

rust-timer commented 11 days ago

Finished benchmarking commit (375662f): comparison url.

Summary:

  • Primary benchmarks: tada relevant improvements found
  • Secondary benchmarks: tada relevant improvements found

Regressions crying_cat_face
(primary) Regressions crying_cat_face
(secondary) Improvements tada
(primary) Improvements tada
(secondary) All crying_cat_facetada
(primary)

count1 0 3 13 31 13

mean2 N/A 0.6% -0.3% -0.5% -0.3%

max N/A 0.6% -0.6% -1.5% -0.6%

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

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

petrochenkov reacted with thumbs up emoji

rustbot

removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

11 days ago

Copy link

Contributor

@cjgillot cjgillot left a comment

This feels so much cleaner!
Should we use the same iter_from_generator to make for_each_module_child return an iterator?

}

/// An adapter for turning a generator closure into an iterator, similar to `iter::from_fn`.

pub fn iter_from_generator<G: Generator + Unpin>(generator: G) -> impl Iterator<Item = G::Yield> {

Copy link

Contributor

@cjgillot cjgillot 10 days ago

I almost feel this should be in std.

Copy link

Contributor

Author

@petrochenkov petrochenkov 10 days ago

I'll make separate PR to add this to libcore, not sure whether it will be merged and how much time it may take.
I don't know why this functionality wasn't added yet, maybe there are reasons - the body of work produced by async-wg is vast, but I didn't read any of it.

petrochenkov

added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

labels

10 days ago

Copy link

Contributor

Author

petrochenkov commented 10 days ago

Should we use the same iter_from_generator to make for_each_module_child return an iterator?

I'll try to do it a bit later in a separate PR.
The previous attempt to do it with iterator combinators wasn't very successfull.

FWIW, I also tried to move insertion of struct/variant constructors to module children lists from decoding to encoding, but encountered some ICE in rustc_mir_transform for generators (petrochenkov@813575f). Probably need to minimize it somehow and report as an issue.

@rustbot ready

rustbot

added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

labels

10 days ago

Copy link

Contributor

cjgillot commented 8 days ago

@bors r+

Copy link

Contributor

bors commented 8 days ago

pushpin Commit 233fa65 has been approved by cjgillot

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

8 days ago

Copy link

Contributor

bors commented 6 days ago

hourglass Testing commit 233fa65 with merge 563ef23...

Copy link

Contributor

bors commented 6 days ago

sunny Test successful - checks-actions
Approved by: cjgillot
Pushing 563ef23 to master...

bors

added the merged-by-bors This PR was explicitly merged by bors label

6 days ago

bors

merged commit 563ef23 into

rust-lang:master 6 days ago

11 checks passed

rustbot

added this to the 1.62.0 milestone

6 days ago

Copy link

Collaborator

rust-timer commented 6 days ago

Finished benchmarking commit (563ef23): comparison url.

Summary:

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results

Regressions crying_cat_face
(primary) Regressions crying_cat_face
(secondary) Improvements tada
(primary) Improvements tada
(secondary) All crying_cat_facetada
(primary)

count1 0 4 0 10 0

mean2 N/A 0.9% N/A -0.7% N/A

max N/A 1.1% N/A -1.4% N/A

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

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

rustbot

added the perf-regression Performance regressions label

6 days ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

cjgillot

Assignees

cjgillot

Labels

merged-by-bors This PR was explicitly merged by bors perf-regression Performance regressions 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

Milestone

1.62.0

Development

Successfully merging this pull request may close these issues.

None yet

6 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK