stats: scope the profiling counters to one run - #288
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.