Improved performance for property lookup. - #65
Merged
Merged
Conversation
Every resolver bound to a node input is defined as a property, and resolving one walked the whole property list - so reading a single input cost a scan of the entire graph, and a graph's cost grew with the square of its own size. The lists keep their definition order; lookups go through a dictionary beside them.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Public mutable definition lists can diverge from the new indexes, causing missing or stale property resolution.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Optimizes graph property resolution by adding name-based indexes while preserving definition order.
Changes:
- Adds dictionaries for constant-time property lookup.
- Updates all resolver paths to use indexed lookup.
- Adds coverage for duplicate and missing property names.
File summaries
| File | Description |
|---|---|
Forge/Statescript/GraphVariableDefinitions.cs |
Maintains property lookup dictionaries. |
Forge/Statescript/GraphContext.cs |
Replaces property scans with dictionary lookups. |
Forge.Tests/Statescript/GraphProcessorTests.cs |
Tests lookup semantics and missing names. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Review of #65: the definition lists stayed public and mutable, so a definition added straight to one would be invisible to every lookup, and ValidatePropertyType still scanned lists while resolution read the index. The four property collections are read-only now and validation goes through the same index.
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.
Every resolver bound to a node input is defined as a property, and resolving one walked the whole property list - so reading a single input cost a scan of the entire graph, and a graph's cost grew with the square of its own size. The lists keep their definition order; lookups go through a dictionary beside them.