Repository navigation
fix(semantics): derive a declaration's implied generals once per symbol - #1350
Merged
Merged
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: jason.han <hanhuijun@gmail.com>
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.
What and why
Develop's CircleCI run of d8b60ed (the merge of #1319) failed "Go race tests" and "Go coverage shards" on 30-minute
go testtimeouts:internal/exec/runtimeunder-racewent from 1322 s (b60a18c) to over 1800 s, its coverage pass from 1192 s to 1671 s, andcmd/sysmlfrom 1524 s to over 1800 s. Until that run is green, no SonarCloud scan of develop's head runs.The cause is
Model.ImplicitGenerals, which #1319 put on the hot path:FeatureTypeSetandfeatureTypesnow call it where they called the memoizedimplicitBases, butImplicitGeneralsitself was derived afresh on every call, each time walking the declared generalization chain (declaredGeneralizationReaches) for three candidate base features. OnTestExecutionConformancethat walk went from 0.6 s to 7.2 s of CPU, a quarter of the run.ImplicitGeneralsnow memoizes per symbol exactly asimplicitBasesdoes (m.resolver.Enter()/Leave()guard,journalfor invalidation, a newimplicitGeneralstable); the derivation iscomputeImplicitGenerals, unchanged. Recorded library symbols still answer from their facts without the table.Measured on this branch,
TestExecutionConformance: 9.5 s at b60a18c, 11.3 s at d8b60ed, 8.2 s with the fix;declaredGeneralizationReachesis back to 0.8 s. The wholeinternal/exec/runtimepackage (no race) on this VM: 271 s at d8b60ed, 223 s with the fix.How it was verified
gofmt -l .empty,go build ./...,go vet ./...,make lint;go testofinternal/semantic/...,internal/workspace/model,internal/workspace/libs,internal/check/...,tests/semantics,tests/resolve,tests/hygieneand the fullinternal/exec/runtimepackage pass.TestImplicitGeneralsAreDerivedOncePerSymbolpins the memoization (a second query answers from the first's slice). CPU profiles before/after as above.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/c2b1ac4ad6de4d8788e78fd86c7c1729
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/c2b1ac4ad6de4d8788e78fd86c7c1729?variant=devin
Requested by: @HuiJun
Overlap with the open perf PRs
Dry-merged against the current heads of #1347 (
perf/memoize-expression-footprints, 2cff947), #1348 (perf/enumerate-children-without-route-walks, 22a1a46) and #1349 (perf/conform-by-symbol, 55b542a, stacked on #1348): all three merge clean with no textual conflict, and the merged trees build, passgo vetoninternal/semantic/...andinternal/exec/runtime, and pass the model tests. No merge commit was needed; if one of those heads moves onto the same lines before this merges, the resolution is a merge of that head, not a redo of its change.