Repository navigation
Look up only a runtime class's own witnesses - #5496
Conversation
A runtime class's first interface lookup collected the witness rules of every runtime class that implements the interface, then tested each one against the receiver. Classes stay in the witness table until a collection sweeps them, so each new class was slower than the last: 500 classes took 38 ms, the 4,000th batch of 500 took 496 ms. A witness's `for` pattern is always exactly its class, so it can only apply to a receiver of that class. The table is now keyed by interface, then by class, and a lookup for a class receiver reads that class's rules only. Other receivers still get every witness, as before. The `mint classes with impls 200` workload from #5421 comes back with a normal job count, now that a job's time no longer depends on the jobs before it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏎️ Performance benchmarks are running for this PRCodSpeed perf benchmarks were triggered because this PR opted in. Results will appear in the CodSpeed check / dashboard once they finish. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Binary size checks failed❌ 2 violations · ✅ 1 passed
Details & how to fixViolations:
Add/update baselines:
[artifacts.bridge_wasm]
file_bytes = 25838234
gzip_bytes = 7637722
[artifacts.packed-program]
file_bytes = 39192960
gzip_bytes = 16071736Generated by |
🤖 Claude on behalf of Antonio
A runtime class's first interface lookup collected the witness rules of every runtime class implementing that interface, then tested each one against the receiver. Minted classes stay in the witness table until a collection sweeps them, so every new class was slower than the one before.
A witness's
forpattern is always exactly its class, so it can only apply to a receiver of that class. The dynamic table is now keyed by interface and then by class, and a lookup for a class receiver reads that class's rules only. Any other receiver still gets every witness, as before.The loop above, ms per batch of 500 classes:
The
interfaces::mint classes with impls 200workload from #5421 comes back withjobs = 60, now that a job's time no longer depends on the jobs before it.interfaces::mint-classes-with-impls-200, 60 jobsinterfaces::polymorphic-dispatch-100k(control)interfaces::to-string-interpolation-10k(control)interfaces::generic-from-json-20k(control)ms per job, speedtest VM row with telemetry off, release builds, pinned to one CPU, two interleaved rounds of 3 trials (the 1-job row: 5 trials).
Registering a witness still bumps the engine-wide generation, which drops every VM's impl cache each time a class is minted. That is a separate cost and is left alone here.
Fixes B-2000.
RUN_CODSPEED=1
Summary by CodeRabbit