Turbopack: Avoid cloning paths in fs watcher if the path is already in a map (#97655)
This is a spiritual continuation of
https://github.com/vercel/next.js/pull/96114 . See
https://github.com/vercel/next.js/pull/94735 for motivation.
This codepath should already be pretty cheap, but in some cases (notably
inotify on Linux where updates aren't debounced as aggressively by the
OS) it could become somewhat hot and waste CPU while other
somewhat-CPU-heavy work is happening in other software (e.g. `pnpm`).
This removes two more sources of clones:
- If we only have a `&Path`, but it's already in the `paths` map, we can
use the raw entry API to avoid cloning it.
- `new_paths` can use `usize` indexes into the `FxIndexMap` instead of
storing another clone of the path. We could also encode this information
as flags on `path`, but the iteration over `new_paths` must happen as a
separate loop before the normal batch execution loop (near the bottom of
`DiskWatcher::watch_thread`), so I'd like to keep it as a separate data
structure to avoid having to filter out a bunch of unrelated keys
without the flag when finally processing the batch.