perf(bytecode): specialize proven numeric recursion#994
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThis PR adds proof-backed closed numeric self-call compilation and VM execution. It introduces three opcodes, compact numeric frames with unwind support, immediate numeric operations, compiler proof discovery, bytecode version 75, documentation, and compiler, VM, and language tests. ChangesClosed numeric self-call specialization
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Sequence Diagram(s)sequenceDiagram
participant Source
participant TGocciaCompiler
participant TGocciaVM
participant Tests
Source->>TGocciaCompiler: compile closed numeric recursive function
TGocciaCompiler->>TGocciaVM: emit OP_CALL_SELF_NUM and numeric immediate opcodes
TGocciaVM->>TGocciaVM: push, execute, return, or unwind numeric frame
TGocciaVM-->>Tests: produce numeric result or stack-limit error
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Web Tooling Benchmark
18 pinned Web Tooling workloads; 18 workloads produced at least one Goccia sample. Raw results from 1 sample per workload; full stdout/stderr for failures and min/max/CV stay in the |
Suite TimingTest Runner (interpreted: 11,519 passed; bytecode: 11,519 passed)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Test runner worker shutdown frees thread-local heaps in bulk; that shutdown reclamation is not counted as GC collections or collected objects.
Benchmarks (interpreted: 439; bytecode: 439)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Benchmark runner performs explicit between-file collections, so collection and collected-object counts can be much higher than the test runner.
Boot
Empty-script ( Measured on ubuntu-latest x64. |
Benchmark Results439 benchmarks · PR vs same-runner Interpreted: 🟢 41 improved · 🔴 25 regressed · 373 unchanged · avg +1.5% Typical per-run noise (median variance): interpreted ±2.0%, bytecode ±2.7%. Deltas within noise overlap and read as unchanged. arraybuffer.js — Interp: 14 unch. · avg +0.1% · Bytecode: 🟢 3, 11 unch. · avg +0.4%
arrays.js — Interp: 🟢 1, 18 unch. · avg +0.8% · Bytecode: 🔴 2, 17 unch. · avg -1.4%
async-await.js — Interp: 🟢 1, 5 unch. · avg +1.8% · Bytecode: 🟢 1, 5 unch. · avg +1.3%
async-generators.js — Interp: 2 unch. · avg -0.9% · Bytecode: 2 unch. · avg -2.9%
atomics.js — Interp: 🟢 1, 5 unch. · avg +3.4% · Bytecode: 🟢 2, 4 unch. · avg +2.5%
base64.js — Interp: 🔴 1, 9 unch. · avg -0.0% · Bytecode: 🔴 1, 9 unch. · avg +0.7%
classes.js — Interp: 🟢 4, 🔴 1, 26 unch. · avg +0.8% · Bytecode: 🔴 1, 30 unch. · avg -0.9%
closures.js — Interp: 11 unch. · avg -0.2% · Bytecode: 🟢 1, 10 unch. · avg +14.2%
collections.js — Interp: 🟢 1, 11 unch. · avg -0.2% · Bytecode: 12 unch. · avg -0.3%
csv.js — Interp: 🟢 1, 🔴 1, 11 unch. · avg +0.6% · Bytecode: 🟢 1, 12 unch. · avg +1.7%
destructuring.js — Interp: 🔴 2, 20 unch. · avg -0.5% · Bytecode: 🟢 1, 🔴 1, 20 unch. · avg -0.4%
fibonacci.js — Interp: 🔴 1, 7 unch. · avg -0.4% · Bytecode: 🟢 4, 4 unch. · avg +121.2%
float16array.js — Interp: 🟢 5, 🔴 4, 23 unch. · avg +0.9% · Bytecode: 🟢 3, 🔴 4, 25 unch. · avg +0.5%
for-in/for-in.js — Interp: 3 unch. · avg +1.5% · Bytecode: 🔴 1, 2 unch. · avg -1.4%
for-of.js — Interp: 🔴 1, 6 unch. · avg -1.8% · Bytecode: 7 unch. · avg -2.5%
generators.js — Interp: 🟢 1, 3 unch. · avg +6.7% · Bytecode: 🟢 1, 3 unch. · avg +3.8%
intl.js — Interp: 🟢 1, 5 unch. · avg +1.7% · Bytecode: 🔴 1, 5 unch. · avg -1.0%
iterators.js — Interp: 🔴 4, 38 unch. · avg -0.7% · Bytecode: 🔴 6, 36 unch. · avg -1.8%
json.js — Interp: 🔴 3, 20 unch. · avg -0.4% · Bytecode: 🟢 2, 21 unch. · avg +0.8%
jsx.jsx — Interp: 🟢 5, 16 unch. · avg +2.1% · Bytecode: 🔴 1, 20 unch. · avg -0.6%
modules.js — Interp: 9 unch. · avg +1.0% · Bytecode: 🔴 1, 8 unch. · avg -2.4%
numbers.js — Interp: 12 unch. · avg +0.7% · Bytecode: 12 unch. · avg +0.7%
objects.js — Interp: 🔴 1, 6 unch. · avg +3.1% · Bytecode: 7 unch. · avg -2.2%
promises.js — Interp: 🟢 2, 10 unch. · avg +4.1% · Bytecode: 12 unch. · avg -2.4%
property-access.js — Interp: 5 unch. · avg +2.8% · Bytecode: 5 unch. · avg -1.6%
regexp.js — Interp: 13 unch. · avg +0.2% · Bytecode: 🟢 1, 12 unch. · avg -1.0%
strings.js — Interp: 🟢 3, 🔴 3, 13 unch. · avg +1.9% · Bytecode: 🟢 1, 18 unch. · avg -0.7%
temporal.js — Interp: 6 unch. · avg +1.5% · Bytecode: 🟢 1, 5 unch. · avg -1.1%
tsv.js — Interp: 9 unch. · avg +0.8% · Bytecode: 🟢 1, 8 unch. · avg +2.4%
typed-arrays.js — Interp: 🟢 7, 🔴 1, 14 unch. · avg +5.2% · Bytecode: 🟢 1, 🔴 8, 13 unch. · avg -4.1%
uint8array-encoding.js — Interp: 🟢 4, 🔴 1, 13 unch. · avg +15.7% · Bytecode: 🟢 6, 🔴 1, 11 unch. · avg +12.7%
weak-collections.js — Interp: 🟢 4, 🔴 1, 10 unch. · avg -0.1% · Bytecode: 🟢 8, 🔴 1, 6 unch. · avg +32.4%
Deterministic profile diffclosures
fibonacci
float16array
typed-arrays
Measured on ubuntu-latest x64. Each PR run also builds the |
JetStream 3 Performance Barometer
Geomean reference ratio: QuickJS 28.23×; Node.js 304.55×. 1.00× means aligned; values above 1.00× mean Goccia was proportionally slower after normalizing JetStream’s higher-is-better score. This is a directional barometer across runtimes with different goals, not a product ranking. Raw samples and failure details remain in the |
AWFY Results
Geomean Ratios
14 pinned AWFY benchmarks. Medians from 5 interleaved samples per engine; raw JSON includes min/max/CV and is attached as the |
test262 Conformance
Areas closest to 100%
Per-test deltas (+0 / -0 / timeout +0 / -1)Resolved timeouts (1):
Steady-state failures and timeouts are non-blocking; PASS → non-timeout failure transitions fail the conformance gate. Measured on ubuntu-latest x64, bytecode mode. Areas grouped by the first two test262 path components; minimum 25 attempted tests, areas already at 100% excluded. Δ vs main compares against the most recent cached |
Summary
OP_SUB_NUM_IMMandOP_JUMP_IF_NUM_NOT_LTE_IMMso provably numeric subtraction and conditional<=avoid generic arithmetic/comparison dispatches.OP_CALL_SELF_NUMfor proven non-tail self-calls with one to three scalar arguments. It uses compact recursive register frames while preserving stack limits, traces, profiling, coverage, timeouts, instruction limits, and GC safety. Generic entry and proper tail calls remain unchanged. The GBC format is now v75.74306fec151070fd07157cefeacf19e7e0bcdc89, not the aggregate benchmark.Testing
Conformance and repository gates:
./format.pas --check, Markdown lint, documentation links/symbols/duplication/length, truncation guards, andgit diff --checkpass.Deterministic retained Fibonacci profile, one inner iteration:
origin/mainMatched production wall time, 25 inner iterations and nine interleaved repetitions:
origin/mainThe independent predecessor comparison was stable at 0.83% baseline CV and 1.02% candidate CV. The main comparison contained one first-candidate cold outlier; its median remained 70.1% faster and the other candidate samples clustered at 71.7-73.0 ms. Every timed sample verified the expected checksum.
Pinned non-synthetic AWFY Sieve guard, 10 inner iterations and nine interleaved repetitions:
origin/mainThe predecessor comparison measured 0.64% baseline CV and 1.00% candidate CV, placing the 0.44% difference within matched noise.