Skip to content

stats: scope the profiling counters to one run - #288

Merged
samoht merged 2 commits into
mainfrom
stats-per-run
Aug 2, 2026
Merged

stats: scope the profiling counters to one run#288
samoht merged 2 commits into
mainfrom
stats-per-run

Conversation

@samoht

@samoht samoht commented Aug 2, 2026

Copy link
Copy Markdown
Owner

The profiling counters were process-global refs reset at every optimize entry, so nested runs clobbered each other and any caller could mutate the tables. Stats.t is now a per-run recorder living in the Ctx the passes already carry, with an immutable snapshot; Css.optimize takes ?stats. The dead per-pass table (no writer since the DAG scheduler) and the never-exported Optimize profiling re-exports are gone - one Breaking line covers the moved surface. Byte-identical over all 504 fixtures; -vv debug output identical on the largest corpus files.

samoht added 2 commits August 1, 2026 22:33
Profiling lives in process-global refs, so an optimization started in
the middle of another overwrites the counts of the run it interrupted,
and the counter record a caller reads is the live one the next run
resets. Both cases fail today.
The counters were process-global refs that Optimize.stylesheet reset on
entry, so an optimization started inside another wiped the numbers of
the run it interrupted, and what a caller read was the live record. Each
run now carries its own recorder on the Ctx every pass already takes;
Css.optimize takes ?stats and Stats.snapshot reads back a value.

Drops the per-pass table and the marginal-stop counter with them: no
pass has written either since the DAG scheduler replaced the multi-pass
fixpoint, so --profile printed an empty table and a constant zero.
@samoht
samoht merged commit 760b2fa into main Aug 2, 2026
5 checks passed
@samoht
samoht deleted the stats-per-run branch August 2, 2026 05:39
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.

1 participant