Avoid many CrateConfig clones.
This commit changes `ExtCtx::cfg()` so it returns a `CrateConfig` reference instead of a clone. As a result, it also changes all of the `cfg()` callsites to explicitly clone... except one, because the commit also changes `macro_parser::parse()` to take `&CrateConfig`. This is good, because that function can be hot, and `CrateConfig` is expensive to clone. This change almost halves the number of heap allocations done by rustc for `html5ever` in rustc-benchmarks suite, which makes compilation 1.20x faster.
This commit is contained in:
parent
d34318dd53
commit
029dceedb9
8 changed files with 18 additions and 14 deletions
|
@ -94,7 +94,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T
|
|||
// The file will be added to the code map by the parser
|
||||
let p =
|
||||
parse::new_sub_parser_from_file(cx.parse_sess(),
|
||||
cx.cfg(),
|
||||
cx.cfg().clone(),
|
||||
&res_rel_file(cx,
|
||||
sp,
|
||||
Path::new(&file)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue