You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 721eb06
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(signals,web): dev cost checks judge only what the user can act on (#3739) (#3850)
* fix(signals,web): dev cost checks judge only what the user can act on (#3739)
Performance tracks take a records-only hold (checks: false unless asked),
WIDE_SCOPE_DEPS skips HMR plumbing sources and the insert's child-resolution
pass (internal dev-only _wide / CONFIG_WIDE), engine-side HUGE_FAN_OUT skips
plumbing subscribers, and the wideDeps default rises 30 -> 500. HUGE_FAN_IN
keeps no exceptions.
Co-authored-by: Claude <[email protected]>
Co-authored-by: Cursor <[email protected]>
* fix(signals): wideDeps default 200; document vite-plugin tracks and opt-in cost checks (#3739)
Co-authored-by: Claude <[email protected]>
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: Cursor <[email protected]>
Attribution cost checks judge only what the scope's author can act on (#3739). `WIDE_SCOPE_DEPS` no longer counts HMR plumbing sources (the `solid-js/refresh` memo per component instance), skips framework scopes marked with the new internal dev-only `_wide` option (`CONFIG_WIDE`; not public API), and its `wideDeps` default rises from 30 to 200. The engine-side `HUGE_FAN_OUT` (`fanOut`) no longer counts plumbing subscribers. The always-on `HUGE_FAN_IN` and core `HUGE_FAN_OUT` (2000) keep no exceptions.
Performance tracks no longer run the attribution cost checks by default (#3739). `enablePerformanceTracks()` — which `@solidjs/vite-plugin` calls in every `vite dev` session — now takes a records-only engine hold, so the six cost checks (`hotRuns`, `hotTime`, `wideDeps`, `unstableMemos`, `fanOut`, `wastedRecompute`) are opt-in again. To turn them back on, pass `enablePerformanceTracks({ attribution: { checks: true } })` (or `performanceTracks: { attribution: { checks: true } }` in the vite plugin), or take your own `attribution.enable()` hold. In dev builds, the `insert` child-resolution effect (which must track each row's resolved child, e.g. every `<Show>` row of a `<For>`) is also exempt from `WIDE_SCOPE_DEPS`; `HUGE_FAN_IN` still covers it.
Copy file name to clipboardExpand all lines: documentation/solid-2.0/08-dev-diagnostics.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -424,7 +424,7 @@ One code, one threshold story, two reporters. **Always on** wherever the diagnos
424
424
425
425
One recompute pass tracked an unusually large number of distinct sources (same thresholds as `HUGE_FAN_OUT`; the sources the pass actually tracked, counted once at the end of the pass — repeat reads of the same source excluded). This is the coarse-read signature — e.g. a helper that touches a whole store, or one memo derived from everything. Narrow the read or split the derivation so each computation tracks only what it needs.
426
426
427
-
Related: `WIDE_SCOPE_DEPS` (below) fires at a much lower threshold, but only while the attribution engine is enabled — it names the offending sources. `HUGE_FAN_IN` is the always-on backstop for the pathological case.
427
+
Related: `WIDE_SCOPE_DEPS` (below) fires at a lower threshold, but only while the attribution engine runs its cost checks — it names the offending sources. `HUGE_FAN_IN` is the always-on backstop for the pathological case, and it has no exemptions: the renderer's insert child-resolution pass and HMR plumbing, which `WIDE_SCOPE_DEPS` does not judge, still count here.
428
428
429
429
#### `GRAPH_GROWTH`
430
430
@@ -442,7 +442,7 @@ Perf-kind warnings emitted by the **attribution engine** — they only fire whil
442
442
443
443
-`HOT_SCOPE_RERUNS`: one scope re-ran 120+ times within 1000ms (above animation-frame cadence, so a legitimate rAF-driven scope doesn't cry wolf). The message names the most recent cause chain. When many scopes go hot from the _same_ root cause (a selection write re-running every row), only the first warns per-node; the rest fold into `HOT_SCOPE_FANOUT` (below) so one culprit can't bury the console in victim warnings.
444
444
-`HOT_SCOPE_TIME`: one scope's summed self-time exceeded 8ms within 1000ms — half a frame in one scope. Catches the few-but-expensive runs that counts miss.
445
-
-`WIDE_SCOPE_DEPS`: a scope's dependency count reached 30 (re-warns after another 50% growth), with the source names listed.
445
+
-`WIDE_SCOPE_DEPS`: a scope's dependency count reached 200 (re-warns after another 50% growth), with the source names listed. It counts what the scope's author can act on: HMR plumbing sources (the dev-only `solid-js/refresh` memo per component instance) are not counted, and in dev builds the renderer's insert child-resolution pass — the effect that must track each row's resolved child, e.g. every `<Show>` row of a `<For>` — is not judged. A memo combining hundreds of per-row memos is judged as written.
446
446
447
447
All three thresholds are configurable (or disable-able) through `enable()` options.
448
448
@@ -956,7 +956,7 @@ The runtime derives a request's trace itself in every tier — the W3C `tracepar
956
956
|`HOT_SCOPE_RERUNS`| warn | perf | 120+ re-runs of one scope in 1s (attribution enabled) |
957
957
|`HOT_SCOPE_FANOUT`| warn | perf | 5+/50+/500+ scopes hot from one root cause (attribution enabled) |
958
958
|`HOT_SCOPE_TIME`| warn | perf | 8ms+ self-time in one scope in 1s (attribution enabled) |
|`UNSTABLE_MEMO_OUTPUT`| warn | perf | Memo returned a new-but-equivalent container 4+ runs running (attribution enabled) |
962
962
|`WASTED_RECOMPUTE`| warn | perf | 80%+ of a scope's 5+ runs in a second produced an unchanged value for 2ms+ of compute — inputs change, result does not (attribution enabled) |
hotRuns: { count:120, windowMs:1000 }, // or false
1016
1016
hotTime: { budgetMs:8, windowMs:1000 }, // or false
1017
-
wideDeps:30, // or false
1017
+
wideDeps:200,// or false
1018
1018
unstableMemos:4, // or false
1019
1019
fanOut:250, // or false (HUGE_FAN_OUT threshold while enabled)
1020
1020
waterfalls: { minFlightMs:50 }, // or false
@@ -1209,10 +1209,12 @@ import { enablePerformanceTracks } from "@solidjs/web/performance-tracks";
1209
1209
const disable = enablePerformanceTracks({
1210
1210
minMs: 0, // floor for run spans; 0 in dev, 0.05 in observe builds
1211
1211
rich: true, // performance.measure with tooltips/properties (dev default) vs console.timeStamp
1212
-
attribution: { values: "labels" } // options for the engine hold it takes (log: false; values: the tier's default)
1212
+
attribution: { values: "labels" } // options for the engine hold it takes (log: false, checks: false; values: the tier's default)
1213
1213
});
1214
1214
```
1215
1215
1216
+
**`vite-plugin-solid` enables the tracks for you under `vite dev`** (`@solidjs/vite-plugin` 3.0.0-next.46+): its `performanceTracks` option defaults to on while serving, injects a client module that calls `enablePerformanceTracks()` ahead of the app's entry, and is off in `vite build`, preview and vitest. Pass `performanceTracks: false` to turn it off, or an object, which is passed through as the `enablePerformanceTracks()` options (`{ minMs, rich, attribution }`). The tracks' engine hold is **records only**: it runs none of the six cost checks (`hotRuns`, `hotTime`, `wideDeps`, `unstableMemos`, `fanOut`, `wastedRecompute`), so a default dev session paints the timeline without turning them on. To get them, opt in explicitly — `enablePerformanceTracks({ attribution: { checks: true } })`, `performanceTracks: { attribution: { checks: true } }` in the plugin, or a hold of your own (`attribution.enable()`), which turns them on beside the tracks while it is held.
1217
+
1216
1218
The adapter scrubs nothing itself: what the spans and tooltips say about values and elements is what the engine put on the records under the hold's `values` level (above) — the tier's default unless the `attribution` option names one: dev shows previews and element text (`"full"`), an observe build shows neither (`"none"`); pass `attribution: { values: "labels" }` for the control labels in an observe build, or `"none"` for a dev timeline without user data.
1217
1219
1218
1220
Group `Solid`, tracks in order: **Interactions** — the input delay, the handler, then the settle to `committed`/`held` (a silent hold as a warning); **Propagation** — one span per scheduler drain labelled by the writes that started it and what they reached (`count 0 → 1 — click on button#next · 5 runs, 1 unchanged`), with every run inside it beneath, labelled by what made it run (`<TodoRow> › effect ← doubled`) — the write's path through the graph as a flame; **Effects** and **Memos** — one span per re-run, creation run (`· create`) and effect callback (`· callback`), coloured by self time, `warning` for a run that changed nothing; **Async** — flights kickoff → landing (abandoned ones as warnings) and fallbacks shown → hidden; **Holds** — each wait labelled by its blockers, `warning` when silent, `error` when long; **Navigations** — request → settle by route pattern; **Server** — server-function calls and frame streams. Every span is emitted retroactively from the record's own `performance.now()` stamps — nothing brackets a hot path.
@@ -1221,7 +1223,7 @@ The **Server** track also shows the server's side of the work it painted from th
1221
1223
1222
1224
Labels read as source: a flow control's own nodes fold into its tag (`<App> › <Show>` rather than `<App> › <Show> › condition value`) and a composed primitive's nodes into the primitive (`createDebounced.value` → `createDebounced`, the same rule as `store.user`), with the runtime's name kept in the span's `Node` property; the `Owner path` property is the unfolded truth and `Node id` the engine's id. A label also starts at the nearest component the developer wrote — `<Search> › results`, not `<Document> › body › <App> › <Router> › … › <Search> › results` — because a track entry is only as wide as its span and the panel elides the middle of a label that does not fit, which in a full path is exactly the part that says which component this is. Solid's own flow controls (`<Show>`, `<For>`, `<Loading>`, `<Portal>`…) are not anchors: a node under `<Card> › <Show>` labels `<Card> › <Show> › effect`. The same cut applies to fallback spans, flights, findings and the Server track's boundary spans; wherever the label is shorter than the path, the full path is the `Owner path` property. Rich mode carries the why-chain (`formatRerun`) as the tooltip, and causes, deps added/removed, phase, origin and interaction as properties.
1223
1225
1224
-
Findings become markers: every `DiagnosticEvent` delivered while enabled is a marker on the panel's Timings track (`SILENT_HOLD — <Search>`), coloured by severity, and — at `warn` or worse — annotated as a performance issue for the Insights sidebar (`detail.devtools.performanceIssue`, with the repair guide's section for the code as its link; Chrome ignores the annotation where it is not yet supported). In dev, every span and marker is emitted inside the `console.createTask` task of the component it belongs to, so the entry's stack in the panel points at the JSX site that rendered the component rather than at the engine. The dev component wrapper creates that task only for components rendered while an attribution engine is installed — `console.createTask` captures a stack per call, roughly the wrapper's own cost again and ~90 B retained per instance, DevTools open or not, and only an attribution consumer reads it — so a dev session with nothing enabled pays nothing, and the tracks enabled at bootstrap see every component's site (a component rendered before any consumer enabled carries no task and its spans are emitted plainly). Enabling takes its own hold on the engine (`attribution.enable({ log: false, ... })` — asking for no console log, which quiets the console only while no other holder wants it), so it coexists with a diagnostics capture or an APM adapter; the returned function releases it. There is one instance per page: a second `enablePerformanceTracks()` while one is running joins it (the first call's options stand) and returns its own release, and the instance is torn down when every release has been called — a module HMR re-evaluates lands back on one set of tracks, not two painters. The adapter is the one place host APIs are called from inside the engine's hooks, and it guards them: a `performance`/`console` call that throws drops that entry (dev warns once) and never reaches the engine.
1226
+
Findings become markers: every `DiagnosticEvent` delivered while enabled is a marker on the panel's Timings track (`SILENT_HOLD — <Search>`), coloured by severity, and — at `warn` or worse — annotated as a performance issue for the Insights sidebar (`detail.devtools.performanceIssue`, with the repair guide's section for the code as its link; Chrome ignores the annotation where it is not yet supported). In dev, every span and marker is emitted inside the `console.createTask` task of the component it belongs to, so the entry's stack in the panel points at the JSX site that rendered the component rather than at the engine. The dev component wrapper creates that task only for components rendered while an attribution engine is installed — `console.createTask` captures a stack per call, roughly the wrapper's own cost again and ~90 B retained per instance, DevTools open or not, and only an attribution consumer reads it — so a dev session with nothing enabled pays nothing, and the tracks enabled at bootstrap see every component's site (a component rendered before any consumer enabled carries no task and its spans are emitted plainly). Enabling takes its own hold on the engine (`attribution.enable({ log: false, checks: false, ... })` — asking for no console log and records only, which quiets the console and the six cost checks only while no other holder wants them; pass `attribution: { checks: true }` to have the tracks' hold run the checks, their findings painted as markers), so it coexists with a diagnostics capture or an APM adapter; the returned function releases it. There is one instance per page: a second `enablePerformanceTracks()` while one is running joins it (the first call's options stand) and returns its own release, and the instance is torn down when every release has been called — a module HMR re-evaluates lands back on one set of tracks, not two painters. The adapter is the one place host APIs are called from inside the engine's hooks, and it guards them: a `performance`/`console` call that throws drops that entry (dev warns once) and never reaches the engine.
0 commit comments