# Not kept What was tried for speed and did not pay, with its numbers (the charter: a speed claim counts only if it wins on every code layout; what does not pay is removed and recorded here). Every ratio is `scripts/ab.sh` (best of 3 alternating rounds of the four workloads, 900 frames each, one pinned E-core, CPU 28, of the shared i9-13900K) unless it says otherwise; the load average is beside it. ## The slot's call and its claims question under one lock (2026-11-26) `console.rs` locks the shared device for a socket call and again to ask whether the call changed the claims (`take_claims_changed`); the step held one guard for both (nothing runs between them). The profile put `Mutex::lock`/`unlock` at about 4 % of Knuckles' Chaotix (`Slot::lock` from `video_first`, `read_word`, `catch_up`, and `claims`). `ab.sh 14339ee` against `ab481bd`, load 21-28: | | Chaotix | VRD | SWA | Doom | total | | --- | ---: | ---: | ---: | ---: | ---: | | default | x1.013 | x1.014 | x1.007 | x1.039 | **x1.018** | | nf5 | x0.999 | x0.974 | x0.996 | x1.012 | **x0.995** | It loses on one layout, so it is not kept (the ladder passed it: rung 1 87 of 87, rung 3 21 of 21, 3b 5 of 5, rung 4 21 of 21). The lock that remains per access is cheap uncontended; what would pay is fewer calls into the device per 68000 access (`video_first`, the access, the claims: three locks), which is the socket protocol's shape (megadrive-rust's `sockets-32x`), not this board's. ## The SH-2 pair's catch-up: a chip stepped while the loop would pick it again (2026-11-26) `SH2Side::catch_up` (`sh2_catch_up`) picks the earlier chip, runs the 32X VDP's and the PWM's events due by its place, takes the chip out of the side (`sh2_with_chip`), steps it once and puts it back. The step kept the chip out and stepped it again for as long as the loop would have picked it with nothing else to do first (still the earlier of the two, chip 0 on a tie; short of the target, `vdp.next_state` and `pwm.next`, each read afresh after every step), so the order of steps and events is unchanged. The profile had `sh2_catch_up` 4.3-4.9 % self and `sh2_with_chip` 2.8-3.1 % (Chaotix, Doom). The ladder passed it (rung 1 87 of 87, rung 3 21 of 21, 3b 5 of 5, rung 4 21 of 21). `ab.sh ab481bd` against `68f845e`, load 16-21, default layout: Chaotix x0.995, VRD x0.995, SWA x0.985, Doom x0.998, **x0.993**; the nf5 run was stopped once the default layout had lost. Why (HYPOTHESIS: batch lengths were not counted): the two chips interleave instruction by instruction (each step moves a chip a few states; the other is then the earlier), so a batch is about one step long and the extra comparisons cost what the saved take-and-put saved. What would pay instead is fewer decisions per instruction: the SH-2 core's own per-step work (its scheduler and checks, sh2-rust-fast docs/status.md) is about 55 % of the board's time. ## sh2-rust-fast: the timers' power-of-two divisions as shifts (2026-11-26, not pinned) The profile had `core::num::div_euclid` at 2.6-3.1 % self (the FRT's, the WDT's and the refresh counter's `x.div_euclid(div)` at every event: `frt_run_until`, `bsc_run_timer`, `Frt::next_event`). Every divider there is a power of two (HM 11.2.5, 12.2.2, 7.2.5), so `x >> div.trailing_zeros()` is the same floor division. sh2-rust-fast branch `board-context-div` (`1e59923`, on `board-context` `43ab381`): sh2-rust-fast's own ladder passed (rungs 0-5, fmt, clippy), and this board's on it (rung 1 87 of 87, rung 3 21 of 21, 3b 5 of 5, rung 4 21 of 21). The A/B, `BIN_A`/`BIN_B` over `1603d31` (LTO, steps 2 and 3 under it): | Run | default | nf5 | Load | | --- | ---: | ---: | --- | | 3 rounds, beside the ladder on CPUs 24-27 | x0.989 (Chaotix x0.962, VRD x0.975, SWA x0.989, Doom x1.029) | x1.038 (x1.030, x1.010, x1.036, x1.078) | 14-22 | | 5 rounds, quieter | x1.008 (x1.012, x0.985, x1.019, x1.011) | x1.012 (x1.000, x1.004, x1.028, x1.014) | 13-14 | At most about 1 %, and one run lost on the default layout: not pinned here. It is the SH-2 tier's change to make; proposed to sh2-rust-fast's owner with these numbers (its own sh2-bench would show it more plainly than a whole board does).