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

swc plugin #2

Open
dingchenaobo opened this issue Apr 3, 2022 · 2 comments
Open

swc plugin #2

dingchenaobo opened this issue Apr 3, 2022 · 2 comments

Comments

@dingchenaobo
Copy link
Owner

You can create and use custom plugins with SWC.

Warning: Passing the AST to the JS Plugin system is a performance bottleneck.

Therefore, we are considering two approaches for the next SWC major version:

Creating a plugin system in Rust (#2337)
Solve the bottleneck to keep a JS plugin system (#2175)

@dingchenaobo
Copy link
Owner Author

You can create and use custom plugins with SWC.

Warning: Passing the AST to the JS Plugin system is a performance bottleneck.

Therefore, we are considering two approaches for the next SWC major version:

Creating a plugin system in Rust (#2337) Solve the bottleneck to keep a JS plugin system (#2175)

感觉他们也很纠结,rsut plugin 当然速度快性能高,但是 rust 本身门槛就很高。js plugin 必然效率比 rust plugin 要低很多,同时这种需要 rust 和 js 交互的性能损耗可能会高于纯 js 写(我理解 n-api 这种方式还是比较适合低频 + 简单的输入 + 简单的输出 + 大量的计算耗时)。不知道 swc 是只用 rust 做了 ast 部分还是也做了其他部分比如 plugin(理论上说应该不需要)

@dingchenaobo
Copy link
Owner Author

You can create and use custom plugins with SWC.
Warning: Passing the AST to the JS Plugin system is a performance bottleneck.
Therefore, we are considering two approaches for the next SWC major version:
Creating a plugin system in Rust (#2337) Solve the bottleneck to keep a JS plugin system (#2175)

感觉他们也很纠结,rsut plugin 当然速度快性能高,但是 rust 本身门槛就很高。js plugin 必然效率比 rust plugin 要低很多,同时这种需要 rust 和 js 交互的性能损耗可能会高于纯 js 写(我理解 n-api 这种方式还是比较适合低频 + 简单的输入 + 简单的输出 + 大量的计算耗时)。不知道 swc 是只用 rust 做了 ast 部分还是也做了其他部分比如 plugin(理论上说应该不需要)

但是站在开发者的角度来说,rust 还是值得一学的

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

No branches or pull requests

1 participant