-
Notifications
You must be signed in to change notification settings - Fork 438
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
perf: use swc or esbuild toolchain to transpile code locally #314
Comments
Looked into this, here's my recommendation:
This solution achieves the best performance w/ minimal configuration. Ideally we wouldn't need two different transpilers but going with either one for both
lmk if this sounds good and I'll open up the PR |
How much faster does this hybrid approach make us when running tests from a cold boot locally? If the savings are meaningful, I'm supportive otherwise I don't think the additional complexity of having multiple build setups is worthwhile. I would also document this rationale in the code in the config files or somewhere obvious, so that it's clear to future maintainers why we chose this hybrid approach. You can just link to this ticket or copy paste the info there if its short enough. |
I opened up a PR to see how it performed in GH Actions: Github hosted runners are only 2-core by default so the slowest tests end up being a bigger factor. |
Let’s do it then, the speed up is worth it
…On Tue, Dec 27, 2022 at 9:00 AM adaddeo ***@***.***> wrote:
yarn test goes from ~43s to ~20s on my machine
yarn test ./src/utils/crypto.test.ts from ~5.8s to ~2.4s
I opened up a PR <#330> to see
how it performed in GH Actions:
shard 1/2 went from averaging ~45s to ~40s
shard 2/2 went from averaging ~70s to ~53s
Github hosted runners are only 2-core by default so the slowest tests end
up being a bigger factor.
—
Reply to this email directly, view it on GitHub
<#314 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEBD4RGLOKW3IWGB6WI5W3WPMODTANCNFSM6AAAAAATF2POV4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What is the feature you would like to implement?
All local actions (yarn start, yarn test) should use a fast transpiler like esbuild or swc, and remote CI actions should compile the code at most once before running tests.
Why is this feature important?
Faster build times makes it easier to work with the Hub codebase
Will the protocol spec need to be updated??
How should this feature be built? (optional)
Currently, we use tsx for yarn start which uses esbuild under the hood, and nothing special for yarn test. In CI, we run yarn tsc and then yarn test with some CI flags. Ideally, we'd do a full typecheck in CI but when running locally we'd just do a fast transpile and execute. We may also be double compiling in CI adding to our run times, needs investigation.
Additional context
There is some complexity due to ESM where additional configuration is needed to get certain packages to work. For example, swc is a drop in replacement in jest, but esbuild requires some fiddling with configurations. Similarly, tsx was the only drop in replacement for yarn start that actually worked.
The text was updated successfully, but these errors were encountered: