swc icon indicating copy to clipboard operation
swc copied to clipboard

Known performance issues

Open kdy1 opened this issue 1 year ago • 4 comments

### Tasks for `oxc` (Thanks!)
- [ ] https://github.com/swc-project/swc/pull/9602
- [ ] Remove `chain!` and apply visitors by one-by-one.
- [ ] For esnext + typescript/ react-dev, resolver / hygiene / fixer is way too much overhead.
- [ ] https://github.com/swc-project/swc/issues/9603
- [ ] `swc_common` should not analyze source code if not required
- [ ] `is_reserved` in `swc_ecma_parser` is not necesssary in many cases
- [ ] https://github.com/swc-project/swc/pull/9613

kdy1 avatar Oct 02 '24 02:10 kdy1

Does this mean chain! will be removed entirely?

leafypout avatar Oct 08 '24 03:10 leafypout

I think we should. It seems like it's misdesigned.

kdy1 avatar Oct 08 '24 03:10 kdy1

If I understand it correctly, it simply visits with A then B, so same as visit_with(A); visit_with(B). I think we should make it combine all visitors together and visit in one pass or just remove it. This might work for some existing visitors but I'm not sure. If it does, it would probably optimize said visitors.

leafypout avatar Oct 08 '24 04:10 leafypout

In the profiling result, visit_with(noop()) was not a noop if it's mixed with Box<dyn Fold>. That's why I think it's misdesigned.

kdy1 avatar Oct 08 '24 08:10 kdy1

image

Performance profiling result for a large file.

kdy1 avatar Oct 30 '24 03:10 kdy1

Renaming pass and block_scoping pass is too slow. image

kdy1 avatar Oct 30 '24 03:10 kdy1

Slow functions: image

kdy1 avatar Oct 30 '24 04:10 kdy1

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

swc-bot avatar Feb 07 '25 12:02 swc-bot