-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Wasm #691
Wasm #691
Conversation
Please land this PR, it's such a game-changer! |
@vovaguguiev Can you tell me your usecase? I think x3 slowdown is not a simple issue. Note: As typical usage of |
I would like to use it in a Cloudflare Worker, the options I have there are either JS or WASM. Even 5x speed up comparing to Babel is a great improvement for my use case because of workers’ limits on CPU time per request (50ms) |
The alternative I am exploring right now is to try and use swc directly from rust code that I compile to wasm, I could write a custom transformation, that I need, directly in Rust similar to how transform-react and other are implemented. Do you think it’s a viable option? |
@vovaguguiev Oh... Fair point. |
@vovaguguiev I'm pinging you because it's almost done. I only implemented I couldn't make apis related to file because wasm does not support it and I'm not sure if threading is supported in wasm. |
@kdy1 Thanks a lot! I think sync versions are enough for my case. Look forward to trying it! |
Published |
@vovacodes did you ever see success with this in a Cloudflare worker? Curious to know what kind of performance you saw / the use case you had? |
I've managed to implement
transformSync
andtrasnformFileSync
within a wasm module.Currently, it does not have same api as
@swc/core
and only two methods are implemented.Benchmark result
(Note: es2015 = es5 as there's no compiler pass to convert es2015 code to es5 code)
It's 3 ~ 4 times slower than the prebuilt binary.
Btw, I'm not sure about the way to implement async apis.