-
Notifications
You must be signed in to change notification settings - Fork 149
experiment(compiler): Add experimental SWC compiler #10598
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
Conversation
96e21a3 to
626fe25
Compare
50f72ef to
801de42
Compare
araujobarret
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AlicanAkyuz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really looking forward to having this experiment on main 🍾
rquartararo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! When testing this locally I’m seeing significant time savings with yarn build and yarn jest => down from 36s to 16s for yarn build and 20s to 16s for yarn jest. 🎉
|
Awesome y'all. I need to fix a few tests but once that's done we can get this into |
@araujobarret - this surprised me too 😄. Not many hacks, but it was quite hard to find how all the pieces fit together since there are no docs. I need to open a PR to the SWC repo giving an example. |
|
My results:
|
aa93d5e
aa93d5e to
5308ae1
Compare
c958bc1 to
9211f80
Compare
ee992c9 to
85c578f
Compare
85c578f to
b0acec8
Compare
* test: extract RTL-based test helpers for artwork filters * refactor: convert SizeFilter spec to use new helpers * refactor: convert KeywordFilter spec to use new helpers * test: un-pend KeywordFilter specs Follow up to #10598

The type of this PR is: Experiment
Description
Similar to Next.js, this PR updates force to use the Rust-based SWC compiler for compilation performance. Still need to run the numbers a bit more and compare against a few things as the results so far are milder than I'd expect. However, that said, everything is just about working! Force compiles and things run as one would expect.
Given the bleeding-edge nature of this work, the time savings need to be substantial enough en-masse to justify moving away from Babel. That Next.js is using it as its main compiler is promising, though.
Update (8/5/2022):
Turning this flag on by default, which should apply to both tests and local development. To opt-out, set this flag in your
.env:A handful of tests (~12) were disabled in this commit and flagged with a comment:
Many of these tests were anomalous; we should go through and resolve but not hold up the performance wins in this PR in the meantime.
Also note that SWC compilation is not enabled in prod; this is only a dev-time DX / CI test runner performance improvement.
Changes:
@swc/jestfor compiling Jest tests with SWC@swc/plugin-relayfor compilingrelaygraphql tags@swc/plugin-styled-componentsfor extracting styled-components style tags for SSR renderingHave also added a new CI job (
test-swc) so that we can compare the old against the new)Issues:
Some Test Commands:
EXPERIMENTAL_SWC_COMPILER=true yarn start, then make changes here and there and resaveEXPERIMENTAL_SWC_COMPILER=true yarn build:client:devEXPERIMENTAL_SWC_COMPILER=true yarn jest Apps/AuctionEXPERIMENTAL_SWC_COMPILER=false yarn startEXPERIMENTAL_SWC_COMPILER=false yarn build:client:devEXPERIMENTAL_SWC_COMPILER=false yarn jest Apps/AuctionInitial Results:
yarn jest Apps/Auction: 35s babel, 18s SWC. With cache 13syarn build:client:dev: 75s babel, 38s SWC. With cache 12s