Skip to content

Commit 04dc66e

Browse files
bench(signals): projection-root-write loads under the dev tier
The warm-up store write sat inside createRoot, where the dev tier's owned-scope write check throws — the file failed to load under SIGNALS_TIER=dev, so CodSpeed compared its prod-dist values against a stale base (two of the four 'regressions' on #3776). Moved outside the root. Plan sec. 43.1 records the first dist-mode CodSpeed run. Co-authored-by: Cursor <[email protected]>
1 parent 3ab88fd commit 04dc66e

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

‎documentation/plans/size-reduction-carve-step1.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,6 +5492,21 @@ source). The 14 "regressions" on `1b9ceb679` are superseded by that
54925492
re-baseline; the four shapes below are the only ones that were real, and
54935493
43.2 is their fix.
54945494

5495+
**The PR's first CodSpeed run** (#3776, `3ab88fd5e` vs `next`): 84
5496+
improved (×2–5 — the layout cost, now gone from the measurement: dbmon
5497+
full tick 750 → 337 ms of simulated time, createOwners ×5), 100 untouched,
5498+
4 "regressed", flagged by CodSpeed itself as compared across different
5499+
runtime environments. All four are the instrument: `merge-merge-mixed(deep
5500+
0, 100, 3, 2)` 46 → 819 µs is a GC landing inside a ~75 ns operation's
5501+
measured window (`--predictable-gc-schedule`; the operation itself is 72–98
5502+
ns on prod and dev dist alike, JIT or `--no-opt`, every variant);
5503+
`merge-static(deep)` −7% is the same window's small cousin; and the two
5504+
`projection-root-write` rows had no live base at all — that file **fails to
5505+
load under the dev tier** (a store write inside `createRoot` trips the
5506+
owned-scope check), so its base was stale while the prod run has values
5507+
(20 µs each, consistent with the file's own reference line). The warm-up
5508+
write moved outside the root so the file runs in every tier.
5509+
54955510
### 43.2 The four unmeasured shapes, on the dist
54965511

54975512
Harness `/tmp/carve/cs3.mjs`: the CodSpeed benches reproduced exactly (one

‎packages/signals/tests/store/projection-root-write.bench.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,16 @@ describe(`one root key per commit, ${KEYS}-key record`, () => {
6363

6464
const [store, set] = createStore<Record<string, { n: number }>>(seed());
6565
void store.k0;
66-
set(d => {
67-
d.k0 = { n: -1 };
68-
});
69-
flush();
7066
setStore = set;
7167
});
68+
// The warm-up write happens outside the root: inside it, the dev tier's
69+
// owned-scope write check throws and the whole file fails to load under
70+
// `SIGNALS_TIER=dev` — leaving CodSpeed to compare a prod run against a
71+
// stale base.
72+
setStore(d => {
73+
d.k0 = { n: -1 };
74+
});
75+
flush();
7276

7377
bench("projection derive: delete + set one ROOT key (#3352)", () => {
7478
for (let c = 0; c < COMMITS; c++) {

0 commit comments

Comments
 (0)