Skip to content

fix: watch include roots recursively once, not every directory - #23375

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
scovich:lsp-macos-hang-fix
Sep 17, 2026
Merged

ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
scovich:lsp-macos-hang-fix

Conversation

@scovich

@scovich scovich commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

vfs-notify registered one recursive watch() per directory in the workspace walk. On macOS, notify's fsevent backend rebuilds the entire FSEventStream on every watch() call, so watching N directories cost O(N^2) realpath/getattrlist syscalls. This translates to minutes of startup in a large workspace.

Fortunately, the per-directory recursive watches became redundant when #21771 switched the watch to RecursiveMode::Recursive, so we can remove most of them. However, symlinked directories are still watched explicitly because macOS fsevent framework does not follow symlinks on its own.

Result: LSP indexing time for https://github.com/delta-io/delta-kernel-rs on my macOS laptop dropped from ~11 minutes to ~45 seconds.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2026
@rustbot

This comment has been minimized.

vfs-notify registered one recursive `watch()` per directory in the workspace
walk. On macOS, notify's fsevent backend rebuilds the entire FSEventStream on
every `watch()` call, so watching N directories cost O(N^2) realpath/getattrlist
syscalls. This translates to minutes of startup in a large workspace.

Fortunately, the per-directory recursive watches became redundant when
rust-lang#21771 switched the watch to `RecursiveMode::Recursive`,
so we can remove most of them. However, symlinked directories are still watched
explicitly because macOS fsevent framework does not follow symlinks on its own.

Result: LSP indexing time for https://github.com/delta-io/delta-kernel-rs on my
macOS laptop dropped from ~11 minutes to ~45 seconds.

@ChayimFriedman2 ChayimFriedman2 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants