swc_ecma_lints overhead #5205
sapphi-red
started this conversation in
Ideas
Replies: 1 comment
-
That is a very good point that I completely forgot about. I think we need these validations at some point in the Rollup pipeline as subsequent logic like tree-shaking may rely on them. But it is only four rules:
While we could add them to the binary transform with reasonable effort (and probably will eventually), I would want to avoid this until we moved scope analysis to Rust. Instead, I think we can easily handle them in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found that replacing this part with
Ok(progam)
trims 300-400ms from the current master branch (ee0639e) on the benchmark I used in #5201.rollup/rust/parse_ast/src/error_emit.rs
Lines 71 to 101 in ee0639e
I guess this is because acorn ran these lints while running the parser (so it's a 1 pass), while SWC needs to run these separately (2 pass).
The current parse algorithm is a 3 pass.
If we made the lint work while doing the binary transformation, we can make it as 2 pass and will reduce the time.
Or given that the lint is no longer part of the parse, maybe it can be simply removed?
Beta Was this translation helpful? Give feedback.
All reactions