-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
big perf regression in collapse_vars #3174
Comments
In the course of looking into this issue, I came across some odd behavior as illustrated by using this --- a/lib/compress.js
+++ b/lib/compress.js
@@ -1363,6 +1363,7 @@ merge(Compressor.prototype, {
extract_candidates(expr.consequent);
extract_candidates(expr.alternative);
} else if (expr instanceof AST_Definitions) {
+ console.error("*** AST_Definitions expr:", expr.print_to_string());
expr.definitions.forEach(extract_candidates);
} else if (expr instanceof AST_DWLoop) {
extract_candidates(expr.condition);
Notice that the properties of |
Possible --- a/lib/compress.js
+++ b/lib/compress.js
@@ -1363,7 +1363,12 @@ merge(Compressor.prototype, {
extract_candidates(expr.consequent);
extract_candidates(expr.alternative);
} else if (expr instanceof AST_Definitions) {
- expr.definitions.forEach(extract_candidates);
+ var len = expr.definitions.length;
+ var i = len - 64;
+ if (i < 0) i = 0;
+ for (; i < len; i++) {
+ extract_candidates(expr.definitions[i]);
+ }
} else if (expr instanceof AST_DWLoop) {
extract_candidates(expr.condition);
if (!(expr.body instanceof AST_Block)) { Also verified using smaller AST_Definitions candidate limits (2, 3, 4, etc) and confirmed that all the With patch above:
|
Just wanted to call a little more attention to this issue - this has huge performance implications, especially for the folks over at @angular/cli. I went from being unable to complete the uglify portion of a build to done in 10 seconds with this patch. Thanks for the investigation and reporting @kzc :) |
The proposed fix above was incorporated into Terser terser/terser#51 and will be in its next release. |
No point keeping this ticket open. |
Thanks for the quick fix on that, @kzc |
Bug report or feature request?
perf regression
JavaScript input
More details in original report: terser/terser#50
The text was updated successfully, but these errors were encountered: