-
-
Couldn't load subscription status.
- Fork 0
Open
Labels
priority: mediumMedium priority performance optimizationMedium priority performance optimization
Description
Summary
Cache the results of getRelativeImportSpecifier() so repeated file pair lookups reuse previously computed relative paths.
Proposed Solution
const relativePathCache = new Map<string, string>();
function getCachedRelativeImportSpecifier(
fromFile: string,
toFile: string,
): string {
const cacheKey = `${fromFile}|${toFile}`;
let result = relativePathCache.get(cacheKey);
if (result === undefined) {
result = getRelativeImportSpecifier(fromFile, toFile);
relativePathCache.set(cacheKey, result);
}
return result;
}- Normalise file paths before building the cache key.
- Clear the cache for every generator execution.
Tasks
- Create a cache keyed by normalized file pair strings
- Ensure all relative specifier calculations go through the cache helper
- Clear the cache each generator execution to avoid stale paths
Definition of Done
- Existing benchmark and stress test suites are run before and after the change; include the metrics in the PR description. This is a mandatory check.
- Unit/e2e tests remain successful.
- Document the cache behaviour if needed.
Metadata
Metadata
Assignees
Labels
priority: mediumMedium priority performance optimizationMedium priority performance optimization