diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index ca735d523146..3e3c41692120 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -56,12 +56,13 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize { + pub fn size_estimate(&self, _tcx: TyCtxt<'tcx>) -> usize { match *self { - MonoItem::Fn(instance) => { + MonoItem::Fn(_instance) => { // Estimate the size of a function based on how many statements // it contains. - tcx.instance_def_size_estimate(instance.def) + //tcx.instance_def_size_estimate(instance.def) + 1 } // Conservatively estimate the size of a static declaration // or assembly to be 1. @@ -321,8 +322,7 @@ impl<'tcx> CodegenUnit<'tcx> { } pub fn compute_size_estimate(&mut self, tcx: TyCtxt<'tcx>) { - // Estimate the size of a codegen unit as (approximately) the number of MIR - // statements it corresponds to. + // Estimate the size of a codegen unit as the number of items in it. self.size_estimate = self.items.keys().map(|mi| mi.size_estimate(tcx)).sum(); } diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index da76cf2236c7..e970a399ac0c 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -328,9 +328,9 @@ fn merge_codegen_units<'tcx>( // Having multiple CGUs can drastically speed up compilation. But for // non-incremental builds, tiny CGUs slow down compilation *and* result in // worse generated code. So we don't allow CGUs smaller than this (unless - // there is just one CGU, of course). Note that CGU sizes of 100,000+ are + // there is just one CGU, of course). Note that CGU sizes of 3,000+ are // common in larger programs, so this isn't all that large. - const NON_INCR_MIN_CGU_SIZE: usize = 1800; + const NON_INCR_MIN_CGU_SIZE: usize = 65; // Repeatedly merge the two smallest codegen units as long as: // - we have more CGUs than the upper limit, or