umijs / mako

An extremely fast, production-grade web bundler based on Rust.
https://makojs.dev
MIT License
1.79k stars 65 forks source link

perf: too much string alloc on tree shaking stage #981

Open xusd320 opened 6 months ago

xusd320 commented 6 months ago

问题

tree shaking 阶段有大量的 swc Ident to_string, move to heap 会产生一定开销。测试 examples/with-antd, to_string耗时占比 7%。

image

https://github.com/umijs/mako/pull/980 中尝试小范围减少 to_string 有一些提升

建议

可以试试直接用 Ident to_id 避免 to_string 操作

stormslowly commented 6 months ago

Id 是比较更加 swc 的用法