Skip to content

Commit 5a1a375

Browse files
ryansolidClaude via Cursorcursoragent
committed
perf(observe): count fan-in by walking the trimmed dep list, not a per-pass bracket
CodSpeed bisect (two scratch branches) put the whole create1to1 -5.8% on begin/endFanInPass + passFanIn++ — two cross-module calls per recompute plus a module-variable increment per first-touch link — which also cost 4-6 points of the shape wins on update1to1 and memoTree. The fan-out increment in insertSubs is free. After trimStaleDeps the dep list IS the pass's distinct sources: one walk there gives the exact count with no module state and no save/restore around nested pulls. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 10b3c36 commit 5a1a375

6 files changed

Lines changed: 1177 additions & 1127 deletions

File tree

‎.changeset/observe-node-shapes.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ cost +15% overall with creation tests 2–3× under polymorphic load.
1818
wrappers no longer spread a fresh options object per effect to inject one.
1919
A dist test pins observe's key set to prod's plus the slots.
2020
- Edge counters are gone. `HUGE_FAN_OUT` is counted by the notify walk a
21-
committed change already makes over its subscribers, `HUGE_FAN_IN` by the
22-
recompute pass over the sources it tracks (one module counter in `link()`).
21+
committed change already makes over its subscribers, `HUGE_FAN_IN` by one
22+
walk of the recompute's trimmed dep list at the end of the pass.
2323
Both therefore fire on the work — the change / the recompute — rather than
2424
on the link, once per node and again after +500 growth (a WeakMap, not a
2525
node field). `WIDE_WRITE` (engine) counts the subscriber list on the write

0 commit comments

Comments
 (0)