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

View file

@ -1,6 +1,6 @@
//! Defines the data structures used for describing instance patches.
use std::collections::HashSet;
use std::{collections::HashSet, path::PathBuf};
use rbx_dom_weak::{
types::{Ref, Variant},
@ -81,6 +81,11 @@ pub struct AppliedPatchSet {
pub removed: Vec<Ref>,
pub added: Vec<Ref>,
pub updated: Vec<AppliedPatchUpdate>,
/// Collected during patch application: `(resolved_absolute_ref_path, meta_or_model_file_path)`.
/// Used to build `RefPathIndex` without re-walking the directory tree.
#[serde(skip)]
pub ref_path_index_entries: Vec<(String, PathBuf)>,
}
impl AppliedPatchSet {
@ -89,6 +94,7 @@ impl AppliedPatchSet {
removed: Vec::new(),
added: Vec::new(),
updated: Vec::new(),
ref_path_index_entries: Vec::new(),
}
}