Skip to content

Conversation

@damassi
Copy link
Contributor

@damassi damassi commented Jul 25, 2022

👋 Looking for volunteers to test this

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:

EXPERIMENTAL_SWC_COMPILER_DISABLED=true

A handful of tests (~12) were disabled in this commit and flagged with a comment:

// FIXME: SWC_COMPILER_MIGRATION

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.


⚠️ To use this feature be sure to prepend the EXPERIMENTAL_SWC_COMPILER=true env flag to any commands

Changes:

Have also added a new CI job (test-swc) so that we can compare the old against the new)

Screen Shot 2022-07-25 at 6 25 07 PM

Issues:

  • There are currently about 11 failing tests

Some Test Commands:

  • EXPERIMENTAL_SWC_COMPILER=true yarn start, then make changes here and there and resave
  • EXPERIMENTAL_SWC_COMPILER=true yarn build:client:dev
  • EXPERIMENTAL_SWC_COMPILER=true yarn jest Apps/Auction
  • EXPERIMENTAL_SWC_COMPILER=false yarn start
  • EXPERIMENTAL_SWC_COMPILER=false yarn build:client:dev
  • EXPERIMENTAL_SWC_COMPILER=false yarn jest Apps/Auction

Initial Results:

  • yarn jest Apps/Auction: 35s babel, 18s SWC. With cache 13s
  • yarn build:client:dev : 75s babel, 38s SWC. With cache 12s

@damassi damassi self-assigned this Jul 25, 2022
@damassi damassi force-pushed the damassi/test-jest-swc branch 3 times, most recently from 96e21a3 to 626fe25 Compare July 25, 2022 18:00
@damassi damassi changed the title experiment(tests): Add experimental @swc/jest compiler experiment(compiler): Add experimental @swc/jest compiler Jul 26, 2022
@damassi damassi changed the title experiment(compiler): Add experimental @swc/jest compiler experiment(compiler): Add experimental SWC compiler Jul 26, 2022
@damassi damassi force-pushed the damassi/test-jest-swc branch 3 times, most recently from 50f72ef to 801de42 Compare July 26, 2022 01:13
@damassi damassi changed the title experiment(compiler): Add experimental SWC compiler [Do Not Merge] experiment(compiler): Add experimental SWC compiler Jul 26, 2022
araujobarret
araujobarret previously approved these changes Jul 26, 2022
Copy link
Contributor

@araujobarret araujobarret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The speed improvement is incredible and my Mac fan thanks you also! Plus no hacks added 👏

AlicanAkyuz
AlicanAkyuz previously approved these changes Jul 26, 2022
Copy link
Contributor

@AlicanAkyuz AlicanAkyuz left a 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
rquartararo previously approved these changes Jul 26, 2022
Copy link
Member

@rquartararo rquartararo left a 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. 🎉

@damassi
Copy link
Contributor Author

damassi commented Jul 26, 2022

Awesome y'all. I need to fix a few tests but once that's done we can get this into main 👍

@damassi
Copy link
Contributor Author

damassi commented Jul 26, 2022

Plus no hacks added

@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.

@damassi
Copy link
Contributor Author

damassi commented Jul 27, 2022

My results:

  • yarn jest Apps/Auction: 35s babel, 18s SWC. With cache 13s
  • yarn build:client:dev : 75s babel, 38s SWC. With cache 12s

@damassi damassi dismissed stale reviews from rquartararo, AlicanAkyuz, and araujobarret via aa93d5e July 27, 2022 01:25
@damassi damassi changed the title [Do Not Merge] experiment(compiler): Add experimental SWC compiler experiment(compiler): Add experimental SWC compiler Jul 27, 2022
@damassi damassi force-pushed the damassi/test-jest-swc branch from aa93d5e to 5308ae1 Compare July 29, 2022 22:47
@damassi damassi force-pushed the damassi/test-jest-swc branch 3 times, most recently from c958bc1 to 9211f80 Compare August 5, 2022 20:45
@damassi damassi force-pushed the damassi/test-jest-swc branch 2 times, most recently from ee992c9 to 85c578f Compare August 5, 2022 21:09
@damassi damassi force-pushed the damassi/test-jest-swc branch from 85c578f to b0acec8 Compare August 5, 2022 21:22
@damassi damassi merged commit 04d7308 into main Aug 5, 2022
@damassi damassi deleted the damassi/test-jest-swc branch August 5, 2022 21:37
@artsy-peril artsy-peril bot mentioned this pull request Aug 5, 2022
anandaroop added a commit that referenced this pull request Oct 20, 2023
anandaroop added a commit that referenced this pull request Oct 20, 2023
anandaroop added a commit that referenced this pull request Oct 20, 2023
anandaroop added a commit that referenced this pull request Oct 20, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants