Repository navigation
perf(metamodel): memoize owned features and supertypes in the direction walk - #2377
Merged
1 commit merged intoNov 19, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
…on walk The effective-direction walk for port features recomputed Type::ownedFeature and the owned supertypes of every type on the inheritance path, per feature. Both are now derived once per element through the evaluator memo, and the owned-feature test runs only for port usages, which alone read it. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
|
CI timings, quick tier (
The race-tier figures ( |
devin-ai-integration Bot
added a commit
that referenced
this pull request
Nov 18, 2026
…pertype memos of #2377 Merges perf/memoize-owned-features-direction-walk and drops this branch's own memos of structureOwnedFeatures and structureOwnedSupertypes in favour of the ones that branch carries; the general-type and feature-direction memos stay. Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
17df973
devin-ai-integration
Bot
deleted the
perf/memoize-owned-features-direction-walk
branch
November 20, 2026 02:34
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
#2251 made the effective direction of a port feature walk the owner's inheritance path (
structureDirectionThrough→structureGeneralWithFeature/structureHasFeature). Each step recomputedType::ownedFeature(structureOwnedFeatures) and the owned supertypes (structureOwnedSupertypes) of the type it visited, once per feature, which roughly doubled the api-json export:TestSymbolStructureMatchesGraphStructurewent from 879 s to 2123 s in the merge queue and thetranslaterace shard from 16.2 to 42.6 min, close to its 55 mingo testtimeout.This change keeps the walk as it is and removes the repeated work:
structureOwnedFeaturesis derived once per element through the evaluator memo (newmemoOwnedFeatureskind).structureOwnedSupertypesis derived once per element throughmemoizedValueList.structureDirectionThroughasks whether the owner owns the feature only for aPortUsage, the one case that reads the answer.No result changes: the computations are the same functions, now behind the memo the neighbouring derivations already use.
How it was verified
CPU profile of
TestSymbolStructureMatchesGraphStructureon the fix(symbol): report a member's direction relative to the type it is read through #2251 head:structureDirectionThroughis 14.0 s cumulative of a 22 s run overexamples/sysml-v2-training, almost all in the two recomputed derivations.Same test, same corpus subset, no race detector, local 8-core machine:
developOPENSYSML_STRUCTURE_DIFFERENTIAL_DUMPfrom the three builds is identical once sorted (the dump order follows the parallel walk).gofmt -l .,go vet ./...,go build ./...,make lint,go test -count=1 ./tests/hygieneandgo test -count=1 ./...pass locally.CI timings of the
translateshard on this pull request and in the merge queue to follow in a comment.Checklist
make testandmake lintpass locally (go test ./...without-racelocally; the race tier runs in the queue)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (none moved)F4,K5) in the body, docs, or changelogImplemented in session Speed up inheritance walk from conjugated port change
Review with Devin · Open in Devin Desktop