perf(workflow): cache manifest baseline lookup in CompileWorkflow path#31584
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix regression in CompileComplexWorkflow performance
perf(workflow): cache manifest baseline lookup in CompileWorkflow path
May 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Caches resolved safe-update baseline manifests per lockfile path on the Compiler instance to avoid repeated HEAD/filesystem baseline reads across repeated compiles in the same process, addressing a benchmark regression in CompileWorkflow hot paths.
Changes:
- Cache the first resolved baseline manifest in
Compiler.priorManifestsduringCompileWorkflowData. - Initialize
priorManifestsinNewCompilerand normalizenilinput inSetPriorManifests. - Add a unit test asserting that baseline manifest resolution populates the cache across repeated compiles.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler.go | Adds first-baseline caching into priorManifests during baseline resolution. |
| pkg/workflow/compiler_types.go | Initializes priorManifests and makes SetPriorManifests(nil) safe. |
| pkg/workflow/compiler_test.go | Adds coverage for baseline cache population across repeated compiles. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
| // This intentionally does not overwrite an existing cache entry so repeated | ||
| // compiles in the same process continue to compare against the same trusted | ||
| // baseline rather than a just-generated local lock file. | ||
| if _, ok := c.priorManifests[lockFile]; !ok { |
| require.NoError(t, compiler.CompileWorkflow(testFile)) | ||
| secondBaseline, ok := manifestCache[lockFile] | ||
| require.True(t, ok, "cached baseline should remain available after second compile") | ||
| require.NotNil(t, secondBaseline, "cached baseline should be non-nil") |
Collaborator
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Collaborator
|
@copilot review all comments |
Contributor
Author
Addressed the actionable review threads in commit
|
Contributor
Author
Reviewed and addressed the actionable review threads in
No additional changes are needed at this point. |
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.
✨ Enhancement
BenchmarkCompileComplexWorkflowregressed by ~23.5% (3.39ms vs 2.74ms historical), indicating extra work in the compile pipeline. This change removes repeated baseline-manifest resolution during repeated compiles on the sameCompilerinstance.What does this improve?
HEAD/filesystem manifest reads inCompileWorkflowDatafor the same lock file.Why is this valuable?
CompileComplexWorkflow), where repeated compiles amplify avoidable I/O/lookup work.Implementation approach:
Compiler.priorManifestskeyed by lock file path.priorManifestsinNewCompilerand normalize nil input inSetPriorManifests.