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

Improve performance by switching from babel #69

Open
o-alexandrov opened this issue Apr 7, 2024 · 6 comments
Open

Improve performance by switching from babel #69

o-alexandrov opened this issue Apr 7, 2024 · 6 comments
Labels
cat: performance 🚀 Issue is related to performance enhancement: proposal 💬 Improvement of current behaviour that needs to be discussed

Comments

@o-alexandrov
Copy link

Describe the enhancement

Switch from babel to swc.

Motivation

Performance should be improved. It's extremely slow in development.

Possible implementations

https://swc.rs/docs/migrating-from-babel

Related Issues

@o-alexandrov o-alexandrov added the enhancement: proposal 💬 Improvement of current behaviour that needs to be discussed label Apr 7, 2024
@github-actions github-actions bot added cat: performance 🚀 Issue is related to performance needs: triage 🏷 Issue needs to be checked and prioritized labels Apr 7, 2024
@chin2km

This comment was marked as off-topic.

@layershifter
Copy link
Collaborator

layershifter commented Sep 26, 2024

To be clear, the parser is only a part of the problem.


If we will switch to SWC as a parser we will gain almost nothing:


To get real benefits, we should move the most of processing to Rust, change approaches and preferably use Deno or another runtime JS runtime to eval code.

And it's a complete rewrite 😊

@chin2km
Copy link

chin2km commented Sep 27, 2024

@layershifter Thanks for the explanations 👍🏻
Would be totally worth it since packages like linaria, pigment-css are gaining market share from styled-components.
Also, Vite with swc is on the rise.

Other than a complete rewrite, can other smaller effort changes improve things?
Like using alternatives like recast | esprima | acorn for estree ast generation. But in combination with @swc/core/transform. So basically we get the benefits of SWC transform. But use other faster alternatives to babel or even babel-parser itself to parse the swc transformed code. In effect, a complete rewrite would not be needed and we can still get benefits of fast SWC transforms?

I'm working on a huge project. Our vite build using @vitejs/plugin-react-swc takes ~2 minutes, but if I disable the linaria plugin and paths alias linaria with styled-components, the build time is just ~1.2 miniutes. Thats a big difference :(

@Anber
Copy link
Owner

Anber commented Sep 27, 2024

Right now, we are experimenting with Rust and oxc.rc, but I can't promise anything.

@Anber
Copy link
Owner

Anber commented Oct 22, 2024

A minor update: I managed to build a PoC on Rust, oxc and Deno. However, it is too early to talk about performance measurements since a minimal set of features is supported so far, and there is no caching at all.

@Anber
Copy link
Owner

Anber commented Oct 22, 2024

The cli version shows almost x10 performance boost.

@o-alexandrov o-alexandrov changed the title Switch from babel to swc Improve performance by switching from babel Oct 25, 2024
@github-actions github-actions bot removed the needs: triage 🏷 Issue needs to be checked and prioritized label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat: performance 🚀 Issue is related to performance enhancement: proposal 💬 Improvement of current behaviour that needs to be discussed
Projects
None yet
Development

No branches or pull requests

4 participants