fix: optimize serve/sourcemap startup from >180s to ~8s

Root cause: notify-debouncer-full with macos_kqueue caused 25K+
directory watch registrations to take >170s on large projects.

Changes:
- Replace notify-debouncer-full with notify-debouncer-mini to avoid
  FSEvents Create+Remove event cancellation and heavy per-watch overhead
- Remove macos_kqueue feature; use FSEvents (matches upstream Rojo)
- Fix VFS read guard: watch_enabled && watch_recursive -> watch_enabled
  so recording mechanism works when watch_recursive is false
- Build RefPathIndex from patch_apply data instead of redundant 4.8s
  WalkDir + 5,854 file re-reads (populate_from_dir)
- Use ServeSession::new_oneshot() for sourcemap without --watch
- Restore simple synchronous watch setup (implicit during reads)

Serve: >180s (never completed) -> ~8s to Listening
Sourcemap: 14.3s -> ~9s
All 489 tests passing.
This commit is contained in:
Joe 2026-03-12 18:02:45 -05:00
parent 4ddc4a3e31
commit 9cf4cea936
10 changed files with 236 additions and 210 deletions

18
Cargo.lock generated
View file

@ -1030,15 +1030,6 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "file-id"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1fc6a637b6dc58414714eddd9170ff187ecb0933d4c7024d1abbd23a3cc26e9"
dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "filetime"
version = "0.2.27"
@ -1920,7 +1911,7 @@ dependencies = [
"fs-err",
"log",
"notify",
"notify-debouncer-full",
"notify-debouncer-mini",
"serde",
"tempfile",
]
@ -1991,16 +1982,15 @@ dependencies = [
]
[[package]]
name = "notify-debouncer-full"
name = "notify-debouncer-mini"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c02b49179cfebc9932238d04d6079912d26de0379328872846118a0fa0dbb302"
checksum = "17849edfaabd9a5fef1c606d99cfc615a8e99f7ac4366406d86c7942a3184cf2"
dependencies = [
"file-id",
"log",
"notify",
"notify-types",
"walkdir",
"tempfile",
]
[[package]]