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

incr.comp.: Cache the specialization_graph query. #48987

Closed
michaelwoerister opened this issue Mar 13, 2018 · 1 comment
Closed

incr.comp.: Cache the specialization_graph query. #48987

michaelwoerister opened this issue Mar 13, 2018 · 1 comment
Labels
A-incr-comp Area: Incremental compilation E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. I-compiletime Issue: Problems and improvements with respect to compile times. WG-compiler-performance Working group: Compiler Performance

Comments

@michaelwoerister
Copy link
Member

Computing the specialization graph for a trait involves looking at lots of things. The result of the query should be easily cacheable:

pub struct Graph {
// all impls have a parent; the "root" impls have as their parent the def_id
// of the trait
parent: DefIdMap<DefId>,
// the "root" impls are found by looking up the trait's def_id.
children: DefIdMap<Children>,
}
/// Children of a given impl, grouped into blanket/non-blanket varieties as is
/// done in `TraitDef`.
struct Children {
// Impls of a trait (or specializations of a given impl). To allow for
// quicker lookup, the impls are indexed by a simplified version of their
// `Self` type: impls with a simplifiable `Self` are stored in
// `nonblanket_impls` keyed by it, while all other impls are stored in
// `blanket_impls`.
//
// A similar division is used within `TraitDef`, but the lists there collect
// together *all* the impls for a trait, and are populated prior to building
// the specialization graph.
/// Impls of the trait.
nonblanket_impls: FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
/// Blanket impls associated with the trait.
blanket_impls: Vec<DefId>,
}

@michaelwoerister michaelwoerister added I-compiletime Issue: Problems and improvements with respect to compile times. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. A-incr-comp Area: Incremental compilation WG-compiler-performance Working group: Compiler Performance labels Mar 13, 2018
@wesleywiser
Copy link
Member

I'll take this.

wesleywiser added a commit to wesleywiser/rust that referenced this issue Mar 14, 2018
bors added a commit that referenced this issue Mar 14, 2018
wesleywiser added a commit to wesleywiser/rust that referenced this issue Mar 15, 2018
kennytm added a commit to kennytm/rust that referenced this issue Mar 19, 2018
…ph_query, r=michaelwoerister

Cache the specialization_graph query

Fixes rust-lang#48987

r? @michaelwoerister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. I-compiletime Issue: Problems and improvements with respect to compile times. WG-compiler-performance Working group: Compiler Performance
Projects
None yet
Development

No branches or pull requests

2 participants