-
-
Couldn't load subscription status.
- Fork 0
Open
Labels
priority: futureFuture consideration performance optimizationFuture consideration performance optimization
Description
Summary
Collect and apply import specifier rewrites in batches so each touched file is parsed and modified only once per generator run.
Proposed Solution
interface ImportUpdate {
filePath: string;
oldSpecifier: string;
newSpecifier: string;
}
const pendingImportUpdates = new Map<string, ImportUpdate[]>();
function scheduleImportUpdate(update: ImportUpdate): void {
const updates = pendingImportUpdates.get(update.filePath) || [];
updates.push(update);
pendingImportUpdates.set(update.filePath, updates);
}
function flushImportUpdates(tree: Tree): void {
for (const [filePath, updates] of pendingImportUpdates.entries()) {
updateMultipleImportSpecifiers(tree, filePath, updates);
}
pendingImportUpdates.clear();
}- Queue import specifier updates per file and write them in a single pass.
- Introduce a multi-update helper to minimise repeated parsing.
Tasks
- Introduce a structure to queue import specifier updates grouped by file
- Implement a single-pass writer (e.g.
updateMultipleImportSpecifiers) that applies all queued rewrites per file - Ensure scheduling and flushing hooks integrate cleanly with existing caching layers
Definition of Done
- Existing benchmark and stress test suites are run before and after the change; include the numbers in the PR description. This is a mandatory gate.
- Unit/e2e tests remain green.
- Add documentation or comments covering the batching lifecycle.
Metadata
Metadata
Assignees
Labels
priority: futureFuture consideration performance optimizationFuture consideration performance optimization