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

Performance regression after v1.4.1-nightly-20240210.1 #8708

Closed
davidmurdoch opened this issue Mar 8, 2024 · 4 comments · Fixed by #8711
Closed

Performance regression after v1.4.1-nightly-20240210.1 #8708

davidmurdoch opened this issue Mar 8, 2024 · 4 comments · Fixed by #8711
Labels
Milestone

Comments

@davidmurdoch
Copy link
Contributor

Describe the bug

Updating from v1.4.1-nightly-20240210.1 to any version thereafter results in a 10-20% increase in compilation time.

I think the update that caused the slow down is related to the latest wasmer update.

Input code

git clone https://github.com/MetaMask/metamask-extension.git
cd metamask-extension
git checkout webpack-perf-regression
nvm use # or use Node v20 if you don't use nvm for managing node version
corepack enable # makes it use correct yarn version
mv .metamaskrc.dist .metamaskrc
yarn
time yarn webpack --no-cache # take note of the time
yarn up @swc/core@1.4.1-nightly-20240210.1 # install faster version of @swc/core
time yarn webpack --no-cache # this should be about 10-20% faster


### Config

```json
n/a, this is a webpack-based project using a basic webpack loader.

Loader: https://github.com/MetaMask/metamask-extension/blob/webpack-perf-regression/development/webpack/utils/loaders/swcLoader.ts

Loader usage is here: https://github.com/MetaMask/metamask-extension/blob/e885236f1b42969106e8b88a0d7e66de3921e999/development/webpack/webpack.config.ts#L105

Playground link (or link to the minimal reproduction)

https://github.com/MetaMask/metamask-extension/tree/webpack-perf-regression

SWC Info output

(I'm away from my desk, but will fill this out later)

Expected behavior

Performance should remain roughly the same between versions.

Actual behavior

It got slower 🥲

Version

v1.4.5

Additional context

Original discussion: https://discord.com/channels/889779439272075314/889780921002246154/1215428591945383936

@kdy1 kdy1 added this to the Planned milestone Mar 8, 2024
@kdy1
Copy link
Member

kdy1 commented Mar 8, 2024

Actually I expected some minor performance improvement while updating wasmer...

@davidmurdoch
Copy link
Contributor Author

Actually I expected some minor performance improvement while updating wasmer...

Yeah, a bit surprising as their release notes even site since performance improvements. I noticed in the PR you create a new tokio runtime for each call to compute and transform_sync, I don't know Rust, but it seems that might cause a bit of additional overhead if it needs to be instantiated for every file (like I'm guessing it would when used with webpack).

@davidmurdoch
Copy link
Contributor Author

Tested the latest release and the performance is back! It is not seem to be any faster or slower for my workflow. Thanks!

sokra added a commit to vercel/next.js that referenced this issue Mar 13, 2024
### What?

- Update `swc_core` to fix performance regression caused by the creation
of the `tokio` runtime.

This PR practically reverts
#62441.

 - Apply various minifier bug fixes.

   - swc-project/swc#8730
   - swc-project/swc#8733
   - swc-project/swc#8725
   - swc-project/swc#8726
   - swc-project/swc#8727

- Apply swc-project/plugins#271 (Closes
PACK-2714)


### Why?

Someone reported a performance regression. See
swc-project/swc#8708

### How?

Closes PACK-2693

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
@swc-bot
Copy link
Collaborator

swc-bot commented Apr 8, 2024

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-project swc-project locked as resolved and limited conversation to collaborators Apr 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants