mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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.