-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Reduce memory use of sty #19549
Reduce memory use of sty #19549
Conversation
My memory measurements are very imprecise (using only GNU Here's the state of
|
Nice! |
70a99e2
to
fe3a98f
Compare
`ty_contents |
@arielb1, did your comment get truncated? |
Sure. But I also mixed up By the way, now that |
@huonw needs rebase |
09bdbb5
to
53e1b9c
Compare
This current inflates memory use more than 3 times.
This cuts memory use dramatically from the previous commit, and reduces use overall. E.g. the memory usage of `rustc -O librustc/lib.rs` seems to drop 100MB from 1.98GB to 1.88GB (on one run anyway).
This reduces memory use for building librustc with -O from 1.88 to 1.76 GB.
This cuts the ty_bare_fn variant to 48 bytes rather than 56. There doesn't seem to be a noticable memory usage decrease from this.
This allows expanding how many arenas exist without users having to care, since they are all created with CtxtArena::new().
This makes sty only 32 bytes on machines with 64-bit pointers.
(on platforms with 64-bit pointers.) The StmtMac variant is rather large and also fairly rare, so let's optimise the common case.
This replaces required the RUST_LOG=... invocation to make it much more user friendly.
I've totally mangled the history with these rebases; sorry, future programmer!
This takes building `librustc/lib.rs` from using 696 MB to 588 (`rustc --no-trans`), and 1.99 GB to 1.87 (`rustc -O`). It also reduces `sty` down to 32 bytes on platforms with 64-bit pointers, at the expense of some more side-tables in `ctxt`. I'm sure there's more gains to be had from reducing the size of the side tables (e.g. by making the actual things they're storing smaller). r? @nikomatsakis
@huonw Which option did you enable to get the size of the enums/variants told by the compiler? |
@tomprogrammer, this PR added the |
This takes building
librustc/lib.rs
from using 696 MB to 588 (rustc --no-trans
), and 1.99 GB to 1.87 (rustc -O
). It also reducessty
down to 32 bytes on platforms with 64-bit pointers, at the expense of some more side-tables inctxt
. I'm sure there's more gains to be had from reducing the size of the side tables (e.g. by making the actual things they're storing smaller).r? @nikomatsakis