Skip to content

Cache resolveAsset calls to improve web performance#396

Merged
ezraripps merged 1 commit into
mainfrom
feature/fix-resolveassets-caching
Jul 9, 2026
Merged

Cache resolveAsset calls to improve web performance#396
ezraripps merged 1 commit into
mainfrom
feature/fix-resolveassets-caching

Conversation

@ezraripps

@ezraripps ezraripps commented Jul 9, 2026

Copy link
Copy Markdown
Member

Caches graph asset path / metadata construction internally with resolveAssets to improve performance on web.

Web calling resolveAssets 190 times goes from 6.5s to ~50ms now with the cache addition.


Note

Medium Risk
Touches core asset-resolution and reachability logic; fast vs FX-like result paths could diverge if railInfo aggregation doesn't match the old scan behavior.

Overview
Caches graph-invariant lookup structures for AnchorGraph.resolveAssets (and listAssets, which delegates to it) so repeated filtered calls—e.g. one per source asset on web—no longer rebuild keys, adjacency buckets, and rail aggregation on every invocation.

Adds a memoized #getResolveIndex() that builds a ResolveIndex once (node keys, rail-inclusive join maps, asset-location buckets, and pre-aggregated railInfo). BFS now seeds from computeStartIndices, using bucket lookup when both asset and location are set instead of scanning the full node list. Result assembly uses buildResultMapFast from railInfo when onlyAllowFXLike is false; the FX-like path still scans nodes to exclude non–FX-like edges.

Reviewed by Cursor Bugbot for commit 6bce448. Bugbot is set up for automated code reviews on this repo. Configure here.

@ezraripps ezraripps self-assigned this Jul 9, 2026
@ezraripps ezraripps mentioned this pull request Jul 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@ezraripps ezraripps merged commit 51b52a1 into main Jul 9, 2026
4 of 5 checks passed
@ezraripps ezraripps deleted the feature/fix-resolveassets-caching branch July 9, 2026 23:13
ezraripps added a commit that referenced this pull request Jul 9, 2026
Includes changes from:
 - #396 
 - #387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants