Enhance PrefetchCache with directory init-file resolution

- Added a new field `dir_init` to `PrefetchCache` to store pre-resolved init-file information for directories, allowing for efficient retrieval during prefetch operations.
- Introduced the `prefetch_dir_init` method in the `Vfs` struct to look up init-file info from the prefetch cache.
- Updated the `prefetch_project_files` function to populate the `dir_init` map based on the defined `INIT_FILE_PRIORITY`.
- Adjusted related tests to ensure proper initialization of the `dir_init` field in various scenarios.

These changes improve the performance of directory handling in the VFS by reducing the need for repeated metadata probes.
This commit is contained in:
Joe 2026-03-06 19:58:07 -06:00
parent f1992a61b1
commit 6168597acb
5 changed files with 159 additions and 66 deletions

View file

@ -274,9 +274,20 @@ fn compute_children_patches(
.get_instance(id)
.expect("Instance did not exist in tree");
let instance_children = instance.children().to_vec();
let instance_children = instance.children();
let snapshot_children = take(&mut snapshot.children);
if instance_children.is_empty() {
for snapshot_child in snapshot_children {
patch_set.added_instances.push(PatchAdd {
parent_id: id,
instance: snapshot_child,
});
}
return;
}
let instance_children = instance_children.to_vec();
let match_result = match_forward(snapshot_children, &instance_children, tree, session);
// Matched pairs: recursively compute patches.