Skip to content

shell: switch to quickjs-jit 0.12.7 with upstream compatibility facade - #2903

Open
huacnlee wants to merge 19 commits into
mainfrom
use-quickjs-jit
Open

shell: switch to quickjs-jit 0.12.7 with upstream compatibility facade#2903
huacnlee wants to merge 19 commits into
mainfrom
use-quickjs-jit

Conversation

@huacnlee

@huacnlee huacnlee commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

Run GPUI Shell through quickjs-jit 0.12.7, preserving the existing QuickJS binding API and sharing one VM with LLRT. Pin the bindings, runtime, and upstream rquickjs compatibility facade to 9a83a7f9cdc178a0ab5d7b29c3c9227b0dcb8620; remove the compatibility crate previously maintained in this repository. The bundled facade is introduced by longbridge/quickjs-jit#22.

Production runtimes enable automatic JIT. Debug runtimes remain interpreter-only. Defer JIT profiling during prelude/module evaluation, construction, initialization, and the first render; warm eligible functions can compile afterward. Cached frames still replay Rust snapshots without rerunning JavaScript.

The benchmarks compare automatic JIT with a true interpreter runtime, check snapshot parity and native entry, and expose categorized compilation/fallback metrics. The current mixed-workload regression remains unresolved; this PR is not evidence that default JIT is ready to merge.

Performance evidence

The 0.12.7 release-tag retest on Apple M3 used release builds, 30 independent processes per version/mode/workload, interleaved serial execution, 64 warmup renders, and 200 measured renders per process. Values below are medians across processes; the P99 column is the median of per-process P99s. Timings include snapshot validation. The interpreter baseline is the same quickjs-jit release with JIT disabled, not a separate upstream rquickjs build.

workload interpreter steady automatic JIT steady JIT speed relative to interpreter interpreter / JIT P99
UI panel 0.8518 ms 0.8472 ms 1.01x, approximately equal 0.9575 / 0.9316 ms
numeric layout 0.1458 ms 0.0159 ms 9.19x 0.1767 / 0.0177 ms
mixed market 0.2156 ms 0.4548 ms 0.47x 0.3018 / 0.6050 ms

The panel entered no native code. The mixed workload fell back in 22/30 automatic samples; the other eight samples each recorded four rejected invalid artifacts. Snapshot checksums matched across all 360 samples. The zero-fallback mixed-workload assertion failed in 4/10 independent repeat runs. These findings supersede the earlier blanket acceptance conclusion; no cross-platform or memory/binary-size conclusions are drawn from this run.

Test Plan

  • git diff --check.
  • cargo tree --locked -p gpui-shell -i quickjs-jit-core: one shared binding core; all six QuickJS/facade packages use the pinned revision.
  • Release build from the pinned Git source.
  • cargo test -p gpui-shell --release tests::benchmark -- --include-ignored --nocapture --test-threads=1: 10 passed, 1 failed. The failure is the existing mixed_market_panel_matches_interpreter_and_enters_native_code zero-fallback assertion, also reproduced before the facade migration.
  • Cached-frame assertions passed through 8,403 nodes with zero additional script renders.
  • No fresh Windows/Linux validation was run for this migration.

Checklist

  • Reviewed the AI-assisted dependency migration and benchmark findings.
  • Keep all QuickJS packages on one upstream revision; no sibling-checkout paths are committed.
  • Resolve mixed-workload fallback and nondeterministic performance before treating automatic JIT as merge-ready.

huacnlee and others added 3 commits September 2, 2026 14:21
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Update the benchmark commands to use the library test module path.

Co-authored-by: Codex <codex@openai.com>
huacnlee and others added 2 commits September 2, 2026 14:39
Use the published quickjs-jit-runtime 0.12.4 crate so its runtime ABI matches quickjs-jit core and sys.

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
@huacnlee

huacnlee commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Apple Silicon Issue #3 diagnostics are now wired through quickjs-jit PR #15 (29d66ef).

Fresh release verification on Apple arm64 / macOS 27:

  • 443-node panel: 66/66 compile failures were tier1_rejections; all unsupported/resource/cancelled/panic/invalid/install categories were zero, with zero installed/native entries and no pending worker jobs.
  • Numeric layout: installed=1, native_entries=1, native_exits=1, osr_entries=1; zero fallback, deopt, invalid artifact, install failure, or pending worker jobs.
  • Numeric interpreter and automatic runs used equal render counts and produced identical snapshot debug trees (layout:165580141).

Commands:

cargo fmt --all -- --check
git diff --check
cargo check -p gpui-shell --tests
cargo test -p gpui-shell --release tests::benchmark::describing_a_panel_stays_inside_the_frame_budget -- --exact --nocapture
cargo test -p gpui-shell --release tests::benchmark::numeric_layout_installs_and_enters_native_code -- --exact --nocapture

The remaining Issue #3 evidence is a paired panel parity run and the statistically sampled 0.12.5 performance comparison.

Co-authored-by: Codex <codex@openai.com>
@huacnlee

huacnlee commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Follow-up 5fab7f4d adds paired panel parity: automatic and interpreter each execute the same 352 real renders, then assert identical complete snapshot debug trees and script-render counts. It also restores the rquickjs-jit dependency alias so cargo machete recognizes the runtime dependency; local cargo machete, debug test compilation, and both release acceptance tests pass. The untracked local assets/ directory was not staged or modified.

Co-authored-by: Codex <codex@openai.com>
@huacnlee huacnlee changed the title shell: switch to quickjs-jit shell: switch to quickjs-jit 0.12.7 with upstream compatibility facade Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant