Skip to content

perf(runtime): compute a feature's effective types once per model - #1351

Merged
HuiJun merged 1 commit into
developfrom
perf/memoize-effective-types
Oct 21, 2026
Merged

HuiJun merged 1 commit into
developfrom
perf/memoize-effective-types

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Since #1276 (an object is typed by every type its feature inherits through subsetting), Context.effectiveTypes is asked for the same feature symbol on every object made as that feature: extractType, directTypes, conjoinedTypes and withConjoinedTypes each call it, and each call re-resolved the feature's typing relationships (declaredTypes → RelationshipsOf → resolveQualified), re-ran FeatureTypeSet over the subsetted features and rebuilt the conjunction. In the 0.11.0 release-gate measurement this was the largest avoidable part of the tests/stressmodel Satisfy/FleetSatisfy and tests/perf Instantiate/FeaturesOf/BatchSatisfy allocation growth: a 300-iteration allocation profile of Satisfy/satellites=32 at #1276's merge commit puts 2.1M of the 2.4M new allocations under declaredTypes/statedTypes and the slices.Clone in effectiveTypes.

effectiveTypes is now memoized per feature symbol on the runtime Model, beside its other per-symbol tables (features, chainHosts, denotedFeatures); the computation moved unchanged to computeEffectiveTypes. The memoized slice is shared, so conjoinedTypes clones before slices.DeleteFunc (the other callers only read). No behaviour changes: the same types in the same order for every call.

How it was verified

Checklist

  • make test and make lint pass locally (runtime package run locally; the full suite runs in CI)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (none covers this internal memo)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (no gate count moved)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/cf22d7a746814d20b2f0eaf11682fef9
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/cf22d7a746814d20b2f0eaf11682fef9?variant=devin
Requested by: @HuiJun


Devin Review

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 21, 2026 11:37
@HuiJun
HuiJun merged commit c2a6582 into develop Oct 21, 2026
50 checks passed
@HuiJun
HuiJun deleted the perf/memoize-effective-types branch October 21, 2026 14:00
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