Skip to content
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

es/minifier: The analyzer calls collect_infects_from too many times #9927

Closed
kdy1 opened this issue Jan 22, 2025 · 0 comments · Fixed by #9924
Closed

es/minifier: The analyzer calls collect_infects_from too many times #9927

kdy1 opened this issue Jan 22, 2025 · 0 comments · Fixed by #9924

Comments

@kdy1
Copy link
Member

kdy1 commented Jan 22, 2025

Image

collect_infects_from calls collect_decls and both of them show up in the profiling result.

for id in collect_infects_from(
&n.right,
AliasConfig {
marks: self.marks,
..Default::default()
},
) {
if v.is_none() {
v = Some(self.data.var_or_default(left.to_id()));
}
v.as_mut().unwrap().add_infects_to(id.clone());
}

for id in collect_infects_from(
&n.function,
AliasConfig {
marks: self.marks,
..Default::default()
},
) {
if v.is_none() {
v = Some(self.data.var_or_default(n.ident.to_id()));
}
v.as_mut().unwrap().add_infects_to(id.clone());
}

https://github.com/swc-project/swc/blob/8f8dcaac2f22f71de538802034db5756e84c7f55/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs#L782C17-L794

for id in collect_infects_from(
init,
AliasConfig {
marks: self.marks,
..Default::default()
},
) {
if v.is_none() {
v = Some(self.data.var_or_default(var.to_id()));
}
v.as_mut().unwrap().add_infects_to(id.clone());
}

@kdy1 kdy1 changed the title The analyzer of the minifier calls collect_infects_from too many times swc_ecma_usage_analyzer: The analyzer calls collect_infects_from too many times Jan 26, 2025
@kdy1 kdy1 changed the title swc_ecma_usage_analyzer: The analyzer calls collect_infects_from too many times es/minifier: The analyzer calls collect_infects_from too many times Jan 26, 2025
@kdy1 kdy1 closed this as completed in 37616c3 Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant