Repository navigation
perf(concerto-core): optimize DecoratorManager.decorateModels for targeted workloads - #1256
Closed
muhabdulkadir wants to merge 5 commits into
Closed
muhabdulkadir wants to merge 5 commits into
muhabdulkadir wants to merge 5 commits into
Conversation
…geted workloads Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
muhabdulkadir
force-pushed
the
moh/perf-decorateModels
branch
from
June 8, 2026 16:55
e0ba7ff to
c74bac2
Compare
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
…x wildcard check Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes DecoratorManager.decorateModels in concerto-core to reduce work for targeted decorator command sets by resolving targets up front and only cloning/processing model files that commands actually affect.
Changes:
- Reworked
decorateModelsto precompute command maps, determine targeted namespaces/models, and decorate only those models (with a shallow AST clone instead of deep cloning). - Added new helper utilities (
shallowCloneModelAst, intersection/merge helpers, import pre-grouping) to reduce allocations and repeated work during decoration. - Expanded
DecoratorManagerunit tests to cover mixed explicit-namespace and wildcard command targeting scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/concerto-core/src/decoratormanager.ts | Refactors decorateModels to apply decorators via targeted model processing, shallow AST cloning, and precomputed command/import maps. |
| packages/concerto-core/test/decoratormanager.js | Adds tests for command target resolution behavior across explicit namespaces, wildcards, and overlapping target types. |
Comment on lines
+518
to
+521
| if (!isTargeted) { | ||
| mf.modelManager = newModelManager; | ||
| newModelManager.addModelFile(mf, null, null, true); | ||
| continue; |
Comment on lines
+373
to
+378
| const decl = decoratedModelManager.getType('test@1.0.0.Person'); | ||
| decl.getDecorator('DeclTarget').should.not.be.null; | ||
| // SSN is also a ConceptDeclaration but 'DeclTarget' only targets declaration name 'Person' | ||
| const ssnDecl = decoratedModelManager.getType('test@1.0.0.SSN'); | ||
| (ssnDecl.getDecorator('DeclTarget') === null).should.be.true; | ||
| }); |
Contributor
|
This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed. |
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.
Closes #
Rewrites
decorateModelsto resolve command targets upfront and only process models that commands actually touch, instead of cloning and traversing all models unconditionally.new ModelManager (no rfdc, no ModelFile reconstruction)falsyOrEqualreplaces Set-basedintersectpushMapValues,executeNamespaceCommand,isNamespaceTargetEnabledrfdcclone and use a shallow clone to only copy what's mutated.Performance
Benchmarked with
skipValidationAndResolution: true(the hot path):The gains scale with the ratio of total models to targeted models. No regressions for single-model or all-models-targeted workloads.
Author Checklist
--signoffoption of git commit.mainfromfork:branchname