Unverified Commit 59160c61 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

Turbopack: Store watcher batch state with bitflags instead of 4 different sets (#96114)

Previously we we had 5 total `FxHashSet`s in `BatchedInvalidations`. Now
we've got one `FxHashMap` and one `FxHashSet`. There was potential
overlap in paths represented in all of these sets.

The old implementation was suboptimal for two reasons:
- We ended up cloning and storing `PathBuf` more times. (Note: there's a
good future opportunity for an arena here too)
- If a path was in both `path` and `path_and_children`, we'd later try
to invalidate paths associated with that twice. This will be a no-op as
we have a lock on the invalidator map and the duplicated path has
already removed from the invalidator map, but it makes us do extra map
lookups that aren't needed.

This still keeps around a separate set for `new_paths` so that we can
more efficiently iterate over them. It's possible it could benefit from
being a flag in the same set, but it's less obvious.
parent ec76f095
......@@ -295,12 +295,12 @@ pub async fn run(args: FsWatcher) -> anyhow::Result<()> {
.await
}
#[turbo_tasks::function(operation)]
#[turbo_tasks::function(operation, root)]
fn disk_file_system_operation(fs_root: RcStr) -> Vc<DiskFileSystem> {
DiskFileSystem::new(rcstr!("project"), Vc::cell(fs_root))
}
#[turbo_tasks::function(operation)]
#[turbo_tasks::function(operation, root)]
fn disk_file_system_root_operation(fs: ResolvedVc<DiskFileSystem>) -> Vc<FileSystemPath> {
fs.root()
}
......@@ -361,7 +361,7 @@ async fn write_link(
Ok(())
}
#[turbo_tasks::function(operation)]
#[turbo_tasks::function(operation, root)]
async fn read_or_write_all_paths_operation(
invalidations: TransientInstance<PathInvalidations>,
root: FileSystemPath,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment