Skip to content

Conversation

nnethercote
Copy link
Contributor

LocalDecl contributes 4-8% of peak heap memory usage on a range of benchmarks. This PR reduces its size from 128 bytes to 56 bytes on 64-bit, and does some clean-ups as well.

r? @matthewjasper

This commit adds some new `LocalDecl` methods:
- `with_source_info`, a most general constructor.
- `new`, a variant of `with_source_info` which represents the most
  common use case.
- `internal` a modifying method (like the already present `immutable`).

It removes some old `LocalDecl` methods:
- `new_internal` and `new_local`, because they're subsumed by the new
  methods.
- `new_return_place`, because it was identical to `new_temp`.

Finally, it cleans up all the use sites.
By boxing `local_info`.
By boxing `user_ty`.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 6, 2020
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Collaborator

bors commented May 6, 2020

⌛ Trying commit 001496c with merge a6ea00593c7d5c879795df6aeb2621d5acc9a924...

@bors
Copy link
Collaborator

bors commented May 6, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: a6ea00593c7d5c879795df6aeb2621d5acc9a924 (a6ea00593c7d5c879795df6aeb2621d5acc9a924)

@nnethercote
Copy link
Contributor Author

@rust-timer build a6ea00593c7d5c879795df6aeb2621d5acc9a924

@rust-timer
Copy link
Collaborator

Queued a6ea00593c7d5c879795df6aeb2621d5acc9a924 with parent 43271a3, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit a6ea00593c7d5c879795df6aeb2621d5acc9a924, comparison URL.

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented May 7, 2020

📌 Commit 001496c has been approved by matthewjasper

@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 7, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 9, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#70834 (Add core::future::{pending,ready})
 - rust-lang#71839 (Make BTreeMap::new and BTreeSet::new const)
 - rust-lang#71890 (Simplify the error Registry methods a little)
 - rust-lang#71942 (Shrink `LocalDecl`)
 - rust-lang#71947 (Dead-code pass highlights too much of impl functions)
 - rust-lang#71981 (Fix `strip-priv-imports` pass name in the rustdoc documentation)
 - rust-lang#72018 (Fix canonicalization links)
 - rust-lang#72031 (Better documentation for io::Read::read() return value)

Failed merges:

r? @ghost
@bors bors merged commit 2b3a114 into rust-lang:master May 9, 2020
@nnethercote nnethercote deleted the shrink-LocalDecl branch May 10, 2020 22:05
@nnethercote
Copy link
Contributor Author

This was a max-rss win for script-servo-check and ucd. (It's clearer on the rustc.perf-lang.org graphs than on a single set of results.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants