| @@ -265,6 +265,14 @@ The reference interpreter duplicates the runtime's semantics on purpose: it is t |
| 265 | 265 | - **`Fiber: Send`.** The `SAFETY` comment now names every thread-local reached on an actor's fiber and why its address is not reused after the fiber moves (the optimiser treats a thread-local's address as constant within a function, after inlining). `IN_SLICE` and `DEFERRED` (read inline in `Shared::push` since issue #61) and `LOCAL` in `local_index` are now read in `#[inline(never)]` functions, like `push_local`: no measurable cost. `callback`'s thread-locals are read only while a C call is in progress, when the actor never suspends. |
| 266 | 266 | - **`stats::MINE` stays inline.** Out of line, it cost 12% on `tests/bench/floats.lse` and 2–3% on `lists` and `dict` (interleaved runs). Disassembling the release `liblouise_rt.a` shows no function that both reaches a thread-local and calls something that suspends (only `sched::worker`, which runs on the scheduler thread's own stack). Nothing guarantees this across compiler versions or inlining changes; if it broke, an allocation after a migration would update another thread's count (a wrong leak-oracle total) or, if that thread never allocated, register into its thread-local slot (a data race). |
| 267 | 267 | - **For engineering review:** (a) whether relying on today's inlining for `MINE` is acceptable, or the oracle should pay the call, or count per actor through `ctx->rt` (which would make `tl_alloc` read its context, and the helpers above `unsafe`); (b) the `Fiber` argument as a whole. |
| 268 | + - **Benchmarks of PR 3 against its base** (issue #105, measured 2026-10-12). The base is `1c901f4`, the end `d8b965d`; both were built with the toolchain of the time, and `scripts/bench.sh` was run 3 times on each, alternated, BENCH_RUNS=7 (best of 21, ms, 22 threads): |
| 269 | + |
| 270 | + | Benchmark | `arith` | `arrays` | `dict` | `effects` | `floats` | `html` | `lists` | `messages` | `parallel` | `timers` | |
| 271 | + |---|---|---|---|---|---|---|---|---|---|---| |
| 272 | + | base | 15 | 126 | 109 | 24 | 62 | 269 | 172 | 54 | 121 | 140 | |
| 273 | + | end | 15 | 126 | 109 | 23 | 63 | 271 | 178 | 60 | 115 | 139 | |
| 274 | + |
| 275 | + Everything is within ±5% except `messages` (+11% wall time on 22 threads, where runs vary most). Instructions on one thread (`perf stat`, exact): `messages` +2.5%, `timers` +1.3%, `parallel` 0. Built with one codegen unit, the difference falls to +0.5% (`messages`) and +0.7% (`timers`). Most of it was the runtime's split into 16 codegen units moving inlining decisions, as issue #104 found too (issue #126 proposes one unit). The rest is the deliberate `#[inline(never)]` on `in_slice_deferral` and `local_index` above, one call per push: kept, as it is what makes the `Fiber: Send` argument hold. |
| 268 | 276 | |
| 269 | 277 | - [x] **M8. The test harnesses duplicate the pipeline and the expectation format.** Size **S**, PRs **(2)** and **(4)**. |
| 270 | 278 | - **The pipeline** (analyse → errors → `lower` → `entry`) is copied 7 times: |