-
-
Couldn't load subscription status.
- Fork 0
Open
Labels
priority: lowLower priority performance optimizationLower priority performance optimization
Description
Summary
Add lightweight memoization for frequently repeated path operations used by the move-file generator.
Proposed Solution
const pathOperationCache = {
dirname: new Map<string, string>(),
basename: new Map<string, string>(),
relative: new Map<string, string>(),
};
function memoizedDirname(filePath: string): string {
let result = pathOperationCache.dirname.get(filePath);
if (result === undefined) {
result = path.dirname(filePath);
pathOperationCache.dirname.set(filePath, result);
}
return result;
}
// Implement similar helpers for basename and relative with composite keys.- Wrap hot
pathhelpers with memoized versions. - Reset caches between generator executions to avoid stale values.
Tasks
- Introduce memoized wrappers for the relevant path helpers
- Replace hot-path usages in the generator with the memoized versions
- Ensure the caches are cleared between generator executions to avoid stale data
Definition of Done
- Existing benchmark and stress test suites are run before and after the change; document the measurements in the PR description. This is non-optional.
- Unit/e2e tests must pass.
- Update comments if the memoization layer needs clarification.
Metadata
Metadata
Assignees
Labels
priority: lowLower priority performance optimizationLower priority performance optimization