Skip to content

fix(signals): a projection's reader pulls the derive it reads through (#4782) - #4796

Merged
ryansolid merged 1 commit into
nextfrom
claude/project-thread-c5xes4-4782
Nov 12, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/project-thread-c5xes4-4782

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #4782.

What

A projection B whose derive reads the leaves of another projection A could run before A re-derived in the same flush. This happens when A's derive sits higher in the heap, for example because it reads a memo. B computed over A's previous answer, A re-derived, and B ran again. A projection R over N such Bs re-ran for each late A, so the flush was O(N²). The reporter's 10,000-node mount went from 2.3 s on rc.13 to 17.5 s on rc.21. This regressed in #3774.

Fix

pullFamily's settled branch read the derive untracked. An untracked read only wakes a lazy or dormant node (prepareComputed(el, false)). It does not refresh a stale one, and a store leaf has no _fn, so its reader never took a height from the derive. That branch now makes the same pull a tracked read of a memo makes (pullComputed(fw, reader)). The derive is brought up to date before any leaf is served, and the reader is lifted above it, so later flushes order it after the derive. It does this without linking, as before.

The pull is ordering only. The F-6 posture handoff and the #4491 stale-reader mark that follow a tracked read are untouched.

This is the reporter's experiment, adopted after checking it against the rules.

Rules checked

Size (local, brotli, against next @ dc33de6)

  • Core floor, hello world, simple app: 0
  • + createStore: +12 B
  • Compiled scenarios were not measured locally (no native compiler in this sandbox). The CI size job covers them.

Tests

  • New packages/signals/tests/projection-reads-projection-4782.test.ts: the issue's shape at N=50, with the derive reading a memo and reading store keys only. Each B runs once and R once. On next the memo case gives 98 B runs and 49 R runs.
  • signals: 6,826 pass, 13 expected fail.

Generated by Claude Code

…#4782)

pullFamily's settled branch read the derive untracked, which wakes a lazy
node but does not refresh a stale one, and a leaf carries no height from
its derive. A projection whose derive sits higher (it reads a memo) was
read stale by a lower projection, which then ran again: O(N^2) per flush
since #3774. The pull now makes the pull a tracked read makes: the derive
brought up to date, the reader lifted above it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE
@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7817955

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@solidjs/signals Patch
test-integration Patch
@solidjs/web Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
solid-js Patch
@solidjs/universal Patch
board-example Patch
canvas-example Patch
server-dbmon-example Patch
todos-server-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown

Size (brotli, eager entry chunk)

scenario head vs base minified vs base minified vs recorded cap lazy chunks (not counted)
signals: core floor (createSignal/Memo/Effect/Root/flush) 7.44 KB 0 B 0 B −84 B 7.43 KB ⚠️ over by 11 B, 104 B minified headroom
signals: + createStore 14.91 KB +12 B (+0.1%) +36 B −588 B 15.13 KB ✅
signals: + isPending/latest 12.22 KB 0 B 0 B −266 B 12.27 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.10 KB 0 B 0 B −11 B 8.12 KB ✅
app: render + one signal (the simple-app floor) 9.73 KB 0 B 0 B −399 B 9.81 KB ✅
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.96 KB 0 B 0 B −367 B 19.11 KB ✅ lazy-page.js 0.04 KB
app: hydrating + every store primitive family 34.26 KB −22 B (−0.1%) +36 B −518 B 34.36 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.72 KB 0 B 0 B −367 B 13.77 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.41 KB 0 B 0 B −318 B 15.50 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 30.04 KB 0 B 0 B −292 B 30.16 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.93 KB 0 B 0 B −452 B 9.99 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.33 KB −29 B (−0.1%) +36 B −1105 B 26.75 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.66 KB +65 B (+0.2%) +36 B −1100 B 33.00 KB ✅ stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.75 KB 0 B 0 B 0 B 11.77 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.96 KB −65 B (−0.2%) +9 B −268 B 34.11 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.06 KB, wire.js 3.48 KB
page: live server components (base + live/GET + action + isPending/latest) 40.30 KB −17 B (−0.0%) +15 B −667 B 40.43 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.05 KB, wire.js 3.48 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 35.94 KB +71 B (+0.2%) +3 B −560 B 36.06 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.06 KB, sc-comments.js 0.20 KB, trace.js 9.07 KB, wire.js 3.48 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 44.27 KB 0 B 0 B −680 B 44.39 KB ✅ eager (counted): web.js 23.64 KB; assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.08 KB, sc-comments.js 0.19 KB, trace.js 9.07 KB, wire.js 3.48 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.51 KB −64 B (−0.2%) +9 B −355 B 41.60 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, server.js 1.03 KB, serverForms.js 3.59 KB, trace.js 9.02 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 50.04 KB 0 B 0 B −676 B 50.20 KB ✅ eager (counted): client.js 28.91 KB; assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.07 KB, server.js 1.03 KB, serverForms.js 3.31 KB, trace.js 9.01 KB, wire.js 3.50 KB
server: floor (getRequestEvent + isServer) 1.27 KB 0 B 0 B 0 B 1.29 KB ✅
server: renderToString (the server-render floor) 22.93 KB 0 B 0 B +2 B 22.92 KB ⚠️ over by 9 B, 18 B minified headroom

⚠️ Over the brotli cap within the minified allowance (passes)

  • signals: core floor (createSignal/Memo/Effect/Root/flush): over brotli cap by 11 B; minified 19,839 B vs 19,923 B recorded with the cap (−84 B) — 104 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • server: renderToString (the server-render floor): over brotli cap by 9 B; minified 77,890 B vs 77,888 B recorded with the cap (+2 B) — 18 B of the 20 B minified allowance left; +0 B minified over this PR's base

Bundled with Rolldown (what Vite ships), brotli q11, decimal KB. A scenario fails only when it is over its brotli cap and its minified size is more than 20 B over the minified recorded with the cap; over the cap within that allowance is brotli layout noise and passes with a warning. Caps and their recorded minified in scripts/size/scenarios.js; the floor and page caps in floor-caps.json are frozen (lower only, or Size-Exception: in the PR body). npm run ratchet lowers caps per RC; it never raises one (scripts/size/README.md).

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 43189861931

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 78.945%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1372
Covered Lines: 1143
Line Coverage: 83.31%
Relevant Branches: 1112
Covered Branches: 818
Branch Coverage: 73.56%
Branches in Coverage %: Yes
Coverage Strength: 30.23 hits per line

💛 - Coveralls

@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.19%

2 warnings

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 1 regressed benchmark
✅ 200 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ hn story page (1,475 anchors): no link handler 23.4 ms 24.7 ms -5.19%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/project-thread-c5xes4-4782 (7817955) with next (0895916)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ryansolid
ryansolid merged commit 6681c1b into next Nov 12, 2026
13 of 14 checks passed
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.

3 participants