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

rustdoc: Put GenericArg::Type into a Box #93941

Closed

Conversation

GuillaumeGomez
Copy link
Member

This is a small experiment to see how it'll impact performance (I think it'll increase memory usage a bit). I don't think it'll be worthwhile to merge it.

r? @camelid

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Feb 12, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in clean/types.rs.

cc @camelid

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 12, 2022
@GuillaumeGomez
Copy link
Member Author

@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 Feb 12, 2022
@bors
Copy link
Contributor

bors commented Feb 12, 2022

⌛ Trying commit f2a2cd2834bd0686f539fea10d0fe5dc6c66afc2 with merge 92df98fcbbbfd0cceadbaec668e157c484de8eb8...

@petrochenkov
Copy link
Contributor

@GuillaumeGomez
Meta: could you mark PR names with the code are that they touch, like "rustdoc: Put GenericArg::Type into a Box"?
Right now from the title it may look like the PR changes AST or HIR.

@GuillaumeGomez
Copy link
Member Author

I'm so sorry I forgot again... >< I'll add it here but sorry for the useless noise...

@GuillaumeGomez GuillaumeGomez changed the title Put GenericArg::Type into a Box rustdoc: Put GenericArg::Type into a Box Feb 12, 2022
@bors
Copy link
Contributor

bors commented Feb 12, 2022

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

@rust-timer
Copy link
Collaborator

Queued 92df98fcbbbfd0cceadbaec668e157c484de8eb8 with parent f8f1751, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (92df98fcbbbfd0cceadbaec668e157c484de8eb8): comparison url.

Summary: This benchmark run shows 29 relevant regressions 😿 to instruction counts.

  • Average relevant regression: 0.5%
  • Largest regression in instruction counts: 0.6% on full builds of projection-caching doc

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 Feb 12, 2022
@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Feb 12, 2022

Surprisingly enough, the memory usage is actually being reduced:

Screenshot from 2022-02-12 21-43-40

But the performance is bit less good:

Screenshot from 2022-02-12 21-45-06

So should we keep this change or not?

@camelid
Copy link
Member

camelid commented Feb 12, 2022

Hmm, the instruction count regressions are higher than I'd like ... but the memory improvement does seem nice. Ideally, we would try to shrink Type instead of just boxing it—though that's quite difficult. I'm ambivalent about this change; I'm not sure whether to merge it or close it.

@GuillaumeGomez
Copy link
Member Author

I'll leave it up to you. We can still take a look at Type in the meantime. ;)

Actually I'll take a look at Type in any case.

@camelid
Copy link
Member

camelid commented Feb 12, 2022

Yeah, I've been meaning to get back to trying to shrink Type for a while now. If you want to look into it, can you try to get rid of https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#variant.QPath.field.self_def_id? That's a hack that should be removed and takes up decent memory space.

@camelid camelid 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 Feb 12, 2022
@bors
Copy link
Contributor

bors commented Mar 4, 2022

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

@GuillaumeGomez
Copy link
Member Author

So what should we do here?

@camelid
Copy link
Member

camelid commented May 20, 2022

My current thinking is the perf improvements aren't worth the regressions and increased code complexity (having to box and unbox). So I propose closing this PR.

@GuillaumeGomez
Copy link
Member Author

Agreed!

@GuillaumeGomez GuillaumeGomez deleted the generic-arg-type-box branch May 20, 2022 08:52
bors added a commit to rust-lang-ci/rust that referenced this pull request May 21, 2022
…, r=notriddle

rustdoc: Reduce clean::Type size

There is no need to keep the `DefId` around since it's allow used to compute if we should show a cast or not. As such, we can simply directly store the boolean.

I think it's not what you had in mind `@camelid` but I guess it's still an improvement? 😉

It was discussed in rust-lang#93941.

r? `@camelid`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc 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