Repository navigation
fix(metamodel): derive general types and feature directions once per element - #2379
Merged
Merged
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>
…ons once per element Type::input, Type::output and Type::directedFeature each walked every effective feature's direction, and each walk re-derived the owned features and supertypes of the owner and of every general type on the way. The three lists and the directions are now memoized per element, so the API JSON export reads them once. 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)".
|
…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>
4 of 6 tasks
devin-ai-integration Bot
added a commit
that referenced
this pull request
Nov 19, 2026
…) into fix/reflect-concrete-metaclasses
6 tasks done
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
The API JSON export allocates far more on
developthan on v0.12.1, and the inherited-member derived properties added in #1915 are where it goes:Type::input,Type::outputandType::directedFeatureeach read the direction of every effective feature of a type, and each of those reads walks the owner's general types.Relation to #2377. #2377 memoizes
structureOwnedFeaturesandstructureOwnedSupertypesfor the same walk and is meant to land first. This branch has #2377 merged into it and carries no copy of those two memos; until #2377 is indevelop, its commit shows in this diff. What this pull request adds on top, per element, ininternal/semantic/metamodel:structureSpecializedGeneralTypes), served to the direction walk without a copy and to every other caller as a list of its own;structureFeatureDirections), read once and shared byinput,outputanddirectedFeature.No property is dropped or changed: the written document is byte-identical.
Benchmark:
develop(5f3a2b3), #2377 (1236e9f), this branchgo test ./tests/export -run '^$' -bench WriteAPIJSON -benchtime 3x -count 6, compared withbenchstat; bothvs basecolumns are againstdevelop. The allocation figures are exact; the timings were taken on a shared 8-vCPU machine and are noisy.Against #2377 alone, this branch takes
allocs/opfrom 965.3k to 523.9k onthen_after_membersand from 5.561M to 3.850M onSimpleVehicleModel(standard form).Where that leaves the two benchmarks against v0.12.1
allocs/op, standard form, the same benchmark run at each commit:developthen_after_membersSimpleVehicleModelthen_after_membersoutputSimpleVehicleModeloutputBoth are now below what #1915 itself cost, but not back at v0.12.1: the document is 1.9 and 1.6 times the size it was then.
How it was verified
sysml -convert api-jsonbuilt from perf(metamodel): memoize owned features and supertypes in the direction walk #2377 and from this branch writes byte-identical documents for all 409.sysml/.kermlmodels underexamples/(pilot corpora included) andtests/testdata/.internal/semantic/metamodel/structure_memo_test.go: a caller that edits a supertype or general-type list it was handed does not change the memoized one, andinput,outputanddirectedFeaturekeep their own selections when read in any order from the shared directions.go build ./...,go vet ./...,gofmt -l .(empty),make lint,python3 scripts/changelog.py checkandgo test ./...pass on the merged tree (tests/hygienere-run after the merge was committed, since its tracked-path check reads the index);go test -C tools ./referee/apijsonpasses.go run -C tools ./cmd/pilot-apijson-diff -checkreproduces the committed baseline on this branch's head (935 files, the specification examples included). The workflow's own differential job is skipped on this pull request.Checklist
make testandmake lintpass locally (go test ./...without-race, andmake lint)changes/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) — no count movedF4,K5) in the body, docs, or changelogImplemented in session Fix API JSON export regression from PR 1915
Review with Devin · Open in Devin Desktop