next.js
59160c61 - Turbopack: Store watcher batch state with bitflags instead of 4 different sets (#96114)

Commit
102 days ago
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.
Author
bgw bgw
Parents
Loading