Skip to content

rustc: put ty_trait and ty_closure behind some indirection, nearly halving the size of ty::sty #13013

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

Merged
merged 2 commits into from
Mar 20, 2014

Conversation

huonw
Copy link
Member

@huonw huonw commented Mar 19, 2014

These variants occur rarely but inflate the whole enum for the other variants, leaving a lot of wasted space. In total this reduces ty::sty from 160 bytes to 96 (on a 64-bit platform).

After this, ty_struct and ty_enum are the largest variants, with the 80-byte substs being the major contributor.

huonw added 2 commits March 19, 2014 22:19
This reduces ty::sty from 160 bytes to just 112, and some measurements
eddyb made suggest that the ty_trait variant occurs very
rarely (e.g. ~1% of all sty instances) hence this will result in a large
memory saving, and the cost of the indirection is unlikely to be an
issue.
This reduces the size of sty from 112 to 96; like with the ty_trait
variant, this variant of sty occurs rarely (~1%) so the benefits are
large and the costs small.
@huonw
Copy link
Member Author

huonw commented Mar 19, 2014

@cmr, a mem-bench would be nice :)

@eddyb
Copy link
Member

eddyb commented Mar 19, 2014

Based on previously collected data, I estimate that between 50MB and 75MB will be freed by this PR.

@emberian
Copy link
Member

graph

The time reduction is because it's just --emit bc (no linking).

bors added a commit that referenced this pull request Mar 20, 2014
These variants occur rarely but inflate the whole enum for the other variants, leaving a lot of wasted space. In total this reduces `ty::sty` from 160 bytes to 96 (on a 64-bit platform).

After this, `ty_struct` and `ty_enum` are the largest variants, with the 80-byte `substs` being the major contributor.
@bors bors closed this Mar 20, 2014
@bors bors merged commit ddc7960 into rust-lang:master Mar 20, 2014
@huonw huonw deleted the tytrait branch April 16, 2014 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants