bytecodealliance / bytecodealliance/ComponentizeJS

Component Size & Performance: JCO/SpiderMonkey vs QuickJS

オープン
#291 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
391
フォーク
53
平均マージ
3日 5時間
マージ済み PR(30日)
1

説明

Hi there,

Let me start by saying that I'm missing a lot of context and that my approach is extremely naive, so please tell me to bugger off. Yet, I would still like to better understand the rational or state-of-the-world.

I'm playing around with various WASI components, mostly in Rust and JS. I did certainly notice the chunky component size of my JS components whenever wasmtime had to recompile them. I didn't think too much of it, thinking that's just the price to pay for bundling an interpreter. However, eventually I built a rust WASI component bundling QuickJS (via the rquickjs crate), which turned out to be slightly faster and significantly smaller. For comparison:

1. JCO => 13M
2. JCO + weval/aot => 29M
3. Rust + QuickJS => 1.9M

Running a naive fibonacci implementation just to get a sense of performance, I get for `fib(40)`:

1. JCO => 45s
2. JCO + weval/aot => 29s
3. Rust + QuickJS => 26s

And startup codgegen/compile times are hugely different roughly propotional to the difference in component size.

I've no clue if this actually SpiderMonkey or if there's something else going on, however I didn't expect the difference to be quite so substantial. Could you help me understand what I'm missing or is this an opportunity?

Thanks,
Sebastian

EDIT: I'm happy to back this up with code-examples, I mostly just wanted to reach out and see if this is something you're aware off or have seen before.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

JCO、weval/aot を使用する JCO、および QuickJS を使用する Rust について、報告された 3 つのコンポーネントサイズ、fib(40) の実行時間、起動時のコード生成時間を再現してください。issue にはファイル、テスト、エントリーポイントが記載されていないため、まず約束されているコード例を依頼または見つけ、SpiderMonkey が原因かどうかを確認してください。差異を説明するか、具体的な最適化の機会を特定できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, rust, wasm
領域
compilers, performance
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。