codegen_units.sort_by_key(|cgu| cgu.name().clone());
// Merge the two smallest codegen units until the target size is reached.
- // Note that "size" is estimated here rather inaccurately as the number of
- // translation items in a given unit. This could be improved on.
while codegen_units.len() > target_cgu_count {
// Sort small cgus to the back
codegen_units.sort_by_key(|cgu| usize::MAX - cgu.size_estimate());
ongoing_translation.submit_pre_translated_module_to_llvm(tcx, metadata_module);
// We sort the codegen units by size. This way we can schedule work for LLVM
- // a bit more efficiently. Note that "size" is defined rather crudely at the
- // moment as it is just the number of TransItems in the CGU, not taking into
- // account the size of each TransItem.
+ // a bit more efficiently.
let codegen_units = {
let mut codegen_units = codegen_units;
codegen_units.sort_by_key(|cgu| usize::MAX - cgu.size_estimate());