wasm performance regression in node 24
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.3k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 283
描述
In xterm.js we use a custom base64 wasm decoder [^1] to decode image data. During a recent package upgrade we saw a major performance drop of the decoder when switching from node 22 to node 24 (SIMD variant):
jerch@linpad:~/xterm-wasm-parts$ nvm use 22
Now using node v22.22.0 (npm v10.9.4)
jerch@linpad:~/xterm-wasm-parts$ node lib/base64/Base64Decoder.wasm.js
duration: 220 ms, rate: 4767 MB/s
duration: 199 ms, rate: 5265 MB/s
duration: 234 ms, rate: 4472 MB/s
jerch@linpad:~/xterm-wasm-parts$ nvm use 24
Now using node v24.13.0 (npm v11.6.2)
jerch@linpad:~/xterm-wasm-parts$ node lib/base64/Base64Decoder.wasm.js
duration: 508 ms, rate: 2064 MB/s
duration: 493 ms, rate: 2126 MB/s
duration: 522 ms, rate: 2008 MB/s
More numbers can be found in the benchmark CI results:
- Node 22 scalar: ~1900 MB/s - here
- Node 24 scalar: ~1700 MB/s - here
- Node 22 SIMD: ~4200 MB/s - here
- Node 24 SIMD: ~1800 MB/s - here
Is this a know issue? (did not find any other similar report here or for v8)
The issue is somewhat serious, as the effect is quite high for SIMD code (numbers above are for the SIMD variant of the decoder), for scalar code the effect is less pronounced but still there.
Sadly I don't know where to start looking, in the --prof file it simply states, that the wasm function took much more cycles.
[^1]: code of the base64 decoder : https://github.com/jerch/xterm-wasm-parts/blob/master/src/base64/Base64Decoder.wasm.ts
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 Node 22 和 Node 24 下使用 lib/base64/Base64Decoder.wasm.js 重现该回归,并比较 issue 中链接的标量和 SIMD 基准测试结果。阅读 src/base64/Base64Decoder.wasm.ts,并检查 WebAssembly 函数附近的 --prof 输出,然后确定导致该问题的 Node 或 V8 变更。回归得到解释,并准备好适当的 fix 或 upstream report 后,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js, wasm
- 领域
- backend, performance
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 43/100