Skip to content

[Performance] Resolve short names once per file version in ShortNameResolver::resolveFromFile() - #8525

Closed
TomasVotruba wants to merge 1 commit into
mainfrom
version-aware-short-name-cache
Closed

TomasVotruba wants to merge 1 commit into
mainfrom
version-aware-short-name-cache

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #8524.

#8524 cached resolveShortClassLikeNames() per file and per stmts version. Its sibling resolveFromFile() in the same class still cached by file path only, with no version check - so once a file was resolved, later passes kept getting the first-pass result even after the stmts changed. It is called per imported name by FullyQualifiedNameClassNameImportSkipVoter, in the same post-processing phase as the method #8524 fixed, so it had the same latent staleness.

This aligns resolveFromFile() with the pattern from #8524:

  • version-aware single-slot cache keyed on the File instance and getNewStmtsVersion(), recomputing when either changes
  • drops the unbounded path-keyed array, so memory no longer grows with the number of processed files
  • same short rationale comment on both cache methods

Added tests mirror the ones from #8524: cache recompute after a stmts change, and correct per-file resolution.

@TomasVotruba
TomasVotruba deleted the version-aware-short-name-cache branch October 1, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants