Repository navigation
Commit fd36d37
feat: Chrome Performance panel tracks for Solid (@solidjs/web/performance-tracks) (#3580)
* feat(web): Chrome Performance panel tracks for Solid — engine foundation, adapter, timeline records
Stage 0 — shared engine foundation (@solidjs/signals, @solidjs/web):
- attribution.enable()/disable() are ref-counted: the engine is shared by
every consumer on the page (a profiler track, an APM adapter, a
diagnostics capture); the first hold installs, each enable() opens a fresh
window over the ring buffers and folds without disturbing live tracking or
others' subscriptions, the last disable() uninstalls.
- `checks` option: one switch for the five thresholded cost checks, for
records-only consumers.
- isSilentHold / isLongHold exported, so adapters paint the engine's own
verdicts rather than re-deriving thresholds.
- dispatchAsInteraction passes at: e.timeStamp; InteractionEvent gains
inputDelayMs (event creation → handler entry, the INP input-delay term) and
handlerMs measures from the handler's actual start.
- ownerPath re-exported from solid-js (client from @solidjs/signals, server
via the ownerLabels twin).
Stage 1 — @solidjs/web/performance-tracks:
- enablePerformanceTracks() paints rerun / interaction / hold / navigation
records and the web runtime's call / frame records as tracks in the
`Solid` group, retroactively from the records' own performance.now()
stamps: performance.measure with detail.devtools (rich: tooltips,
properties; dev default) or the six-argument console.timeStamp (observe
default). Track seeding for stable display order, minMs floor, scrub mode
for shared traces, ref-counted disable. Prod artifact folds to a no-op.
- rollup dev/observe/prod entries, ./performance-tracks export conditions,
types script.
Stage 2 — timeline records (@solidjs/signals, solid-js, @solidjs/web):
- Five listener-gated records on attribution.subscribe: create (a
computation's creation run), effect (an effect callback, timed and joined
to its compute run), flush (one scheduler drain), flight (an async flight
to landing or abandonment), fallback (a loading boundary's fallback from
show to hide). None is built, logged or folded unless a listener for its
type exists; OBSERVE.subjectOf answers for the node-bearing ones.
- Core: flushStart hook beside flushEnd (one drain, never nested);
effectRunStart now fires in observe like its effectRunEnd twin, so writes
inside effect callbacks carry their effect origin in observe too. Observe
core +67 B minified; prod byte-identical.
- The effect-frame → node map is filled by the first write inside a
callback rather than by every callback (every reader resolves it through
a write's origin; most callbacks never write). Enabled-engine cost per
effect callback is at or below `next` on every configuration measured.
- Adapter: creation runs and callbacks on Effects/Memos, drains on a new
Scheduler track, flights and fallbacks on a new Async track.
Tests: ref-counting, checks, inputDelayMs, the adapter spec (18), the
timeline records (12), dist-artifact coverage of both new hooks per tier.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* feat(web): Propagation track — each drain as a wave of its root writes, runs labelled by cause, flow internals folded
Replaces the Scheduler track. Nothing re-renders in Solid, so React's
component flame has no counterpart; the picture is the graph a write
travelled. Each drain paints as a wave named by its root writes and the
interaction (`count 0 → 1 — click on button#next · 5 runs, 1 unchanged`);
compute runs, creations and effect callbacks paint inside it at their own
time labelled `node ← cause`, and the panel stacks them beneath the wave.
Labels fold framework structure into what the developer wrote: flow-control
internals (Show/Switch/Loading/Errored/Reveal) present as the tag,
`primitive.local` names as the primitive, the runtime name kept in a
`Node` property. The boundary nodes and Switch's condition builder are now
named in observe builds so the fold has names to key on.
Engine: ChangeRecord.nodeId on writes and derived changes, same id space as
RerunEvent.nodeId, so a derived cause joins the run that produced it.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* compiler: rename componentNames → sourceNames (boolean | { components })
The option becomes the home for every kind of source name the compilers
carry into output for the dev/observe runtimes to label the graph with;
`components` is the existing behavior, further kinds follow. Object form
picks kinds; `true` turns on every kind.
Both compilers, the node adapter's validation (rejects the old name and
malformed shapes), typings, READMEs, tests, and the web server test config.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* compiler: sourceNames.bindings — name compiled binding effects by their target
Attribute effects get `<tag>.<attribute>` as written (`span.textContent`,
`div.class:active`; a merged effect lists all its bindings), holes
`<tag>.children` through insert's options, spreads pass the tag and the
runtime labels `<tag>.spread` / `<tag>.children`. Static holes (component
calls, literals) create no effect and get no name. `prop:` the locked DOM
property pre-pass added is undone in the label (`input.value`).
@solidjs/web: `effect`/`insert` take `{ name }`, `spread` a trailing tag;
names land on the render effect nodes for the dev/observe tiers.
Both compilers, parity fixtures (dom-source-names suite replaces
dom-component-names, run with `sourceNames: true`), option validation,
runtime spec, READMEs.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* compiler: transformSourceNames pass names primitives from their declared identifier
The sourceNames.primitives half of Stage 3.5, as its own native pass since
it is plain JavaScript in and out and applies to .ts/.js modules: calls
resolving to solid-js / @solidjs/signals imports (createSignal, createMemo,
createOptimistic, createStore, createOptimisticStore, createProjection) gain
{ name } from the array pattern, binding, property key, or class field they
initialise, prefixed with the enclosing non-component function so a composed
primitive's nodes fold under it. Never overrides an explicit name; skips
spread/opaque options and the ambiguous two-argument createStore(x, y).
Stores now honour options.name in the observe tiers: property nodes read
todos.title instead of store.title, derived/optimistic stores included.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* feat(performance-tracks): findings as markers, JSX-site stacks, richer node properties
Stage 4 of the Chrome performance tracks plan.
- Every DiagnosticEvent delivered while the tracks are enabled is a marker
on the panel's Timings track (`SILENT_HOLD — <App> › <Search>`), coloured
by severity; at warn or worse it carries detail.devtools.performanceIssue
for the Insights sidebar, with the repair guide's section as learnMoreUrl.
info stays a plain marker. Under the scrub only code, kind and owner travel.
Plain mode uses the one-argument console.timeStamp.
- Dev: observedComponent stores console.createTask(label) on _component.task;
the adapter emits every span and marker inside the nearest component's task
so the entry's stack in the panel is the JSX site (React's _debugTask).
- Rich mode adds Owner path (unfolded), Node id and the root write's Origin
to node spans.
- solid-js exports diagnosticGuideUrl(code), shared with the console footer.
- Docs: 08-dev-diagnostics gains the timeline records, the ref-counted
enable, the INP join recipe and a performance-tracks section; the plan
lands as documentation/plans/chrome-performance-tracks-plan.md.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* chore(size): fold source-name plumbing out of prod; ratchet observe caps for the tracks records
Measured against the branch base (49887e1) with the size scenarios:
prod core floor, + createStore, + isPending and frames byte-identical;
simple app -26 B, CSR -7 B, hydrating + stores -38 B, hydrating +40 B (two
`computed(fn, void 0)` trailing arguments the boundary names fold to; the
restructured alternatives measured larger under brotli).
- createStoreNext loses its `name` parameter - a parameter survives into
the prod artifact; the public createStore records the name through
nameStore (same attrHooks gate) under __OBSERVE__ instead.
- web spread's `.spread`/`.children` labels sit behind "_SOLID_OBSERVE_" so
prod folds them to undefined rather than testing the argument at runtime.
- Observe tier 17.00 -> 17.15 KB (17,063 measured, +92 B: flushStart site,
effectRun hooks under __OBSERVE__, flow-internal and binding names, store
names). Observe + attribution 27.50 -> 28.30 KB (28,200 measured, +738 B:
ref-counted enable, checks, hold verdicts, at/inputDelayMs, the flush /
create / effect / flight / fallback records, nodeId on derived causes).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* fix(signals): fallback records time the display, not the swap
A <Loading> swap is a staged write that lands with its frame (#3575); the
engine held the fallback open from the swap and so timed — and, for a swap
the content outran or the commit's sweep cleared before any effect ran,
recorded — a fallback that was never on screen. The show now carries the
transaction the swap is staged in; the engine moves the open to the drain at
transitionSettled, follows transitionMerged, stamps `at` at flushEnd, and
drops an open hidden before that. The folds hear show/hide from the same
gate. Observe caps ratcheted (+72 B tier, +253 B engine); prod unchanged.
Co-authored-by: Claude via Cursor <[email protected]>
* fix(web): performance-tracks review fixes — single instance, server-inert export, guarded host calls, owned clearing
- enablePerformanceTracks: one instance per page; a call while enabled joins
it and returns its own release; torn down at the last release
- ./performance-tracks: node/worker/deno conditions resolve to the inert
artifact under every posture (the tracks are a browser view)
- Emitter guards performance/console calls; a throw drops the entry and
never reaches the engine's record loop (dev warns once)
- rich:false falls back to performance.measure when console.timeStamp is
missing (the mirror of the existing fallback)
- rich mode clears a User Timing name only while the timeline holds no more
of it than the adapter made; an app measure sharing a label is left alone
- signals: stagedFallbacks is a WeakMap keyed by transaction (DRAIN is an
object key) so a dropped transaction releases its staged opens
- changeset: stale 'Scheduler track' wording -> Propagation
- docs: transformSourceNames is the compiler pass, sourceNames.primitives
the Vite plugin option
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* feat(signals): attribution.enable returns its release; options layer per hold; dev component tasks only under an installed engine
Review items 5 and 6 on #3580.
- attribution.enable(opts) returns an idempotent release for the hold it
takes. Options in effect = defaults with each live hold's opts layered in
hold order, recomputed on release — a track's log:false beside a console
session gives the log back when it leaves. disable() is the full teardown
whatever holds are outstanding, so enable();enable();disable() cannot
strand a hold. Prod twin: enable returns noop.
- performance-tracks releases through the token and layers log:false only
when it is the consumer installing the engine (OBSERVE.attribution.installed
=== null); joining leaves a co-holder's options alone.
- solid-js dev: the component wrapper creates the console.createTask task
only while an attribution engine is installed. The per-call stack capture
roughly doubled dev mount (10k components 1.9 -> 4.1 ms) for sessions with
nothing enabled; observe and prod builds never contained the call.
- Tests: layered options + release, disable teardown, adapter join vs
install log default, task gating; docs and changesets updated.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* test: CI fixes — tuple typing in the tracks harness, fallback timing asserted against the commit stamp
- web test-types: the stubbed-API list is typed [object, string][] (the
inferred (string | Console | Performance)[] failed tsc); getEntriesByName
is restored with the rest
- signals: the shell-landed-first fallback test asserts at >= the landing
stamp and shownMs >= the wait instead of a wall-clock upper bound, which a
slow runner exceeded
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* fix(diagnostics): captures hold the engine through enable()'s release token
capture.ts and the browser bridge release their own hold instead of calling
disable(), which under the token contract is the full teardown — a track
or APM adapter enabled beside a capture now survives it.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* feat(signals): attribution options combine across holds by the most demanding request
Replaces last-wins layering. Each hold's request is resolved against the
defaults (an explicit undefined is unsaid; checks:false folds its five
checks first), then combined per key: booleans OR, historyLimit max, a
threshold config over false, and between configs the bound that fires
sooner (lower count/budget/ms, longer windowMs). A hold adds to what the
engine does and never takes away what another asked for, so the result is
independent of the order holds were taken — a track enabled with log:false
beside a console session leaves its log alone in either order; a capture
with tight thresholds beside a records-only adapter runs the checks for its
own duration. Prior art: Node trace_events (union of every enabled
Tracing's categories), CDP per-session domain enablement.
- performance-tracks: always asks {log:false, ...options.attribution};
the install-time heuristic is gone
- tests: order independence, checks while any holder wants them,
explicit undefined; adapter beside a console session
- size: engine scenario 28.85 -> 29.00 KB (+194 B, engine-only), noted
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* chore(size): CSR prod cap 15.80 -> 15.85 KB after rebasing over #3586/#3555
The merge with the new next measured 15,815 B against next's 15,764: the
same +51 B brotli name-assignment noise this branch has carried (minified
bundles 44,649 B on both sides), now on top of upstream bytes those PRs
left 36 B under the cap. No prod source changed.
Co-authored-by: Cursor <[email protected]>
* docs: name the Vite plugin as the owner of sourceNames.primitives
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>1 parent 43fae6e commit fd36d37
102 files changed
Lines changed: 6707 additions & 263 deletions
File tree
- .changeset
- documentation
- plans
- solid-2.0
- packages
- babel-plugin
- src
- dom
- test
- __dom_source_names_fixtures__
- bindings
- components
- ssr
- compiler
- __tests__
- fixtures/dom-source-names
- bindings
- components
- ssr
- parity
- src
- dom
- ssr
- universal
- diagnostics
- src
- signals
- src
- core
- store
- next
- tests
- solid
- src
- client
- server
- test
- server
- web
- performance-tracks
- src
- src
- test
- server
- scripts/size
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments