Skip to content

Improved performance for property lookup. - #65

Merged
lextatic merged 2 commits into
mainfrom
perf/statescript-property-index
Sep 6, 2026
Merged

lextatic merged 2 commits into
mainfrom
perf/statescript-property-index

Conversation

@lextatic

@lextatic lextatic commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@lextatic lextatic added the changed Changes in existing functionality label Sep 6, 2026
@lextatic
lextatic requested a balanced review from Copilot September 6, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

Comment thread Forge/Statescript/GraphVariableDefinitions.cs
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.
@lextatic
lextatic merged commit a3c24a0 into main Sep 6, 2026
1 check passed
@lextatic
lextatic deleted the perf/statescript-property-index branch September 6, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changed Changes in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants