improve symbol replacement heuristic (#2851)

This commit is contained in:
Alex Lam S.L
2018-01-29 17:41:15 +08:00
committed by GitHub
parent 6fa3fbeae8
commit 541e6011af
2 changed files with 33 additions and 1 deletions

View File

@@ -5237,7 +5237,7 @@ merge(Compressor.prototype, {
var name_length = d.name.length;
var overhead = 0;
if (compressor.option("unused") && !compressor.exposed(d)) {
overhead = (name_length + 2 + value_length) / d.references.length;
overhead = (name_length + 2 + value_length) / (d.references.length - d.assignments);
}
d.should_replace = value_length <= name_length + overhead ? fn : false;
} else {