Profile and reduce Oxide code-image startup, peak RSS, and package size

未关闭
#192 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
44/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
performance

调研方向

Start with the remaining initialization work: examine object, closure, and cell allocation and capped-heap accounting, then compare the identified Hero script-turn cost with QJBC. Use the existing Hero replay and report changes against the recorded instruction counts; image decoding and instantiation are also named areas to measure. The issue sets a separate rollout gate: record identical Tab5 release package results against the device QJBC ABI and exercise packaged workers before changing the default engine.

由索引模型根据 Issue 内容生成。

描述

Baseline

Stock PocketJS Hero, Linux x86-64, same release replay host, same bundle and assets, 20 boot-only samples per engine in ABBA order.

Metric Oxide OXBC v2 QuickJS QJBC (NG 0.16.2)
Boot median 10.76 ms 6.33 ms
Median process peak RSS 10,776 KiB 8,046 KiB
UI bytecode section 480,993 B 148,909 B

The compiler-free Oxide host matched QJBC for all 360 replay frames, the ordered host-call trace, and the final framebuffer.

Work

  • Account for bytecode bytes by section and attribute startup instructions and allocation peaks across package admission, realm and host setup, decode, relocation/publication, instantiation, and first execution.
  • Land and measure the first round of improvements to the dominant costs. Recheck the same Hero replay, format rejection before execution, no-draw boot, process peak RSS, UI bytecode bytes and the engine Sweep.
  • Validate the rollout on Tab5 with the release ESP-IDF QuickJS QJBC ABI and exercise the PocketJS worker path. Record that evidence before changing the default engine.

First optimization round

The paired rerun used Linux CPU 2, the same original Hero bundle and assets, and 20 boot-only samples per arm. QJBC ran through the existing PocketJS C guest.

Metric OXBC v2 OXBC v3 QuickJS QJBC
Boot median 10.85 ms 9.00 ms 6.34 ms
Median boot peak RSS 10,728 KiB 9,628 KiB 8,092 KiB
UI bytecode section 480,993 B 289,412 B 148,909 B
  • Fixed-width instructions and position tables accounted for 79.8% of OXBC v2. V3 uses variable-width immediates and delta-coded source positions and preserves backtraces.
  • Massif attributed 1,034,592 bytes to an eager copy of the asset pak. When the native registry has mounted assets, the guest creates the private __pak buffer on first access. Massif's sampled live allocation peak dropped from 5,667,338 to 4,441,015 bytes.
  • Loading now validates the relocated tree's input once and uses its explicit tree links for instantiation. Callgrind attributed 17.68M instructions to v2 loading and 12.37M to v3 loading.
  • The capped heap skips growth calculations for arenas with zero requested records. The capacity-check work dropped from 11.55M to 10.25M instructions at the same 19,228 checks. One collection ran on the profiled boot.
  • The compiler-free host still matched QJBC for 360 frames, the host operation log and the final pixels. The release build rejects v2 before effects, and a v3 exception after a host operation stops startup. The instruction and loop-size Sweep gates passed after refreshing linker symbol ordering. The 37-workload engine peak-RSS geometric mean was 0.998×.

Remaining

  • Reduce the initialization cost. Hero's Oxide script turn accounts for 42.00M instructions compared with 28.52M in QJBC's script execution. Examine object, closure and cell allocation and capped-heap accounting. Image decoding and instantiation still account for 7.72M and 4.65M instructions respectively.
  • Measure identical Tab5 release packages against the device QJBC ABI and exercise packaged workers. The Linux QJBC results above are for the native diagnostic ABI.
主要语言
Rust
星标
61
派生
2
PR 合并指标
30 天内没有已合并 PR

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pocket-stack/quickjs-oxide 的其他 Issue

查看 pocket-stack/quickjs-oxide 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。