| Code-Review | +1 |
AD. Issue 62760. Optimize LibraryContext.removeAdd description of the change accomplishes.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: pkg/analyzer/lib/src/dart/analysis/library_context.dart
Insertions: 2, Deletions: 1.
@@ -161,7 +161,8 @@
var removedCycles = removed
.map((file) => file.kind.library?.internal_libraryCycle)
.nonNulls
- .toFixedList();
+ .where(loadedBundles.contains)
+ .toSet();
loadedBundles.removeAll(removedCycles);
removedKeys.addAll(removedCycles.map((cycle) => cycle.linkedKey));
}
```
AD. Issue 62760. Optimize LibraryContext.remove
Update library invalidation so `LibraryContext.remove()` can identify
removed library cycles directly from the removed files.
Previously file eviction cleared `file._kind` before
`LibraryContext.remove()` ran. Once that happened, the library cycle for
a removed file was no longer available, so removal had to scan all
loaded bundles and check whether any cycle contained one of the removed
files.
Run bundle removal while file kinds are still intact and have
`LibraryContext.remove()` derive the affected cycles directly from the
removed files. This lets it remove those cycles from `loadedBundles` and
collect their linked keys without scanning unrelated bundles.
To support this ordering, file-state pruning now exposes a hook that
runs before disposal begins, and file change handling collects affected
files before evicting them. This keeps library invalidation targeted and
avoids extra work during cache cleanup.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |