Skip to content

docs: ADR 0039, record I2 and I3 as rejected - #441

Open
linyiru wants to merge 2 commits into
masterfrom
docs/adr0039-rejects
Open

linyiru wants to merge 2 commits into
masterfrom
docs/adr0039-rejects

Conversation

@linyiru

@linyiru linyiru commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Records the measured rejection of ADR 0039's I2 (code pointer cache) and I3 (safe-point countdown). Part of #378 / #385.

  • I2: the ceiling (both code fetches switched to get_unchecked, which is cheaper than any cache) cut instructions 4.3% but cycles only ~1.5%, inside noise on starship.
  • I3a: a fuel-only countdown was implemented and kept RUBYRS_FUEL exact. It cut instructions 7% but cycles only 0.4% (10.284 → 10.240e9, 8-round medians). Folding in the SIGINT check was not attempted, because it would change when a trap handler runs after a self-sent Process.kill.
  • Isolated variants: removing check_fuel alone made the loop 7% slower. Code-layout effects at this scale are bigger than either change.

The ADR's status is now: I1 shipped, I2/I3 rejected, I4/I5 planned. This PR changes docs only.

🤖 Generated with Claude Code

Both were measured on starship before landing. The I2 ceiling (unchecked
indexing, cheaper than any cache) moved cycles ~1.5%, and the I3a fuel
countdown moved them 0.4%. Both are inside the noise, so they fail the
ADR's own gate. Isolated variants also showed code-layout effects of
+-7%, larger than either change, so the numbers are recorded to keep
anyone from retrying these without first making the countdown
register-resident.
Copilot AI balanced review requested due to automatic review settings September 29, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The I2 ceiling is not technically established, and supporting details include an inaccessible artifact and inaccurate call-site count.

Review effort: Balanced
Findings: 3 Low severity

Open (3)
What changed in this PR

Documents performance experiments rejecting ADR 0039’s I2 and I3 optimizations.

Changes:

  • Records benchmark results and rejection rationale.
  • Updates ADR status and consequences.
File Description
docs/​adr/​0039-per-call-fixed-cost.md Records rejected interpreter optimizations and measurements.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +104 to +107
- The ceiling was measured first. Both fetch sites were switched to `get_unchecked` (an
experiment only), which is cheaper than any cache could be. On starship (`o.n` loop,
interleaved rounds against master 9c4f5877, 2026-09-29), instructions fell 4.3% but
cycles fell only ~1.5%, inside run-to-run noise.
- `RUBYRS_FUEL` stayed exact, because every op took the slow path while metered.
- The deadline cadence was unchanged.
- Tier 2's settle gate read an exact derived `op_count()`.
- The patch is kept as `a4-tmp/i3a-countdown.diff` on the Studio's DevSSD.
- **What would remove the cost.** The countdown would have to live in a register, as a
local of the dispatch loop, which means taking `check_fuel` out of `step()`.
- `step()` is also driven by tier 2 and by the iterator drivers.
- `check_fuel` has 23 call sites.
Probing the explicit-recv IC first gave -4.4% cycles on the o.n loop,
but it regressed builtin-resolving calls. The semantics-preserving
version kept only -1.7% while adding two instructions per iteration,
so the earlier gain was mostly code layout.

This branch has not been deployed

No deployments
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.

2 participants