Optimize action pinning and caching: eliminate redundant JSON parsing and I/O#9016
Merged
Optimize action pinning and caching: eliminate redundant JSON parsing and I/O#9016
Conversation
- Cache parsed action pins in memory using sync.Once - Add dirty flag to ActionCache to skip unnecessary saves - Batch cache saves until end of compilation instead of after each resolution - Tests updated to handle dirty flag behavior Performance improvements: - Reduced action pins unmarshaling from 40+ to 1 per compilation - Eliminated redundant cache saves during compilation - Action cache only saves once at end with all accumulated changes Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize compilation process with action pinning and caching
Optimize action pinning and caching: eliminate redundant JSON parsing and I/O
Jan 5, 2026
Collaborator
|
@copilot format, lint go and review code to increase robustness, simplicity, readability, maintainability |
- Fix potential panic: safely truncate SHA for logging (handle short SHAs) - Replace O(n²) bubble sort with O(n log n) sort.Slice for better performance - Simplify NewActionCache: rely on zero value for dirty flag with comment - Add dirty flag reset in Load() to ensure clean state after loading from disk - Run gofmt to fix indentation in test files All tests pass. No functional changes, only code quality improvements. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done! Applied code improvements in commit 3a7ed9c: Robustness:
Performance:
Readability:
All tests pass with no functional changes. |
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.
Action Pinning and Caching Optimization ✅
Successfully optimized the compilation process to eliminate redundant operations and improve performance.
Problem Analysis
getActionPins()call unmarshal + sort = ~80-120µs (cumulative: 3-4ms)Implemented Solutions
1. Action Pins In-Memory Caching
sync.Onceto ensure single initialization2. Action Cache Dirty Flag
dirtyboolean flagCode Quality Improvements (Latest Commit)
Robustness
Performance
Simplicity & Readability
Performance Impact
Testing Results
✅ All tests pass:
TestActionPinsCaching- Verifies caching behaviorTestActionCacheDirtyFlag- Verifies dirty flag optimization✅ Code quality verified:
Summary
This optimization significantly improves compilation performance and code quality through:
The changes are minimal, focused, and thoroughly tested with no impact on existing functionality.
Original prompt
Review the following log and optimize the compilation process, and specially actions pinning and caching: