dingchenaobo / swc-demo

基于 swc + ts 的 node runtime 和 build 的一些简单尝试
0 stars 0 forks source link

swc plugin #2

Open dingchenaobo opened 2 years ago

dingchenaobo commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 还是值得一学的