wasm performance regression in node 24
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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