Support @parcel/watcher as the watcher alternative#13699
Merged
nachocodoner merged 18 commits intorelease-3.3from Apr 23, 2025
Merged
Support @parcel/watcher as the watcher alternative#13699nachocodoner merged 18 commits intorelease-3.3from
nachocodoner merged 18 commits intorelease-3.3from
Conversation
…oss-os perserving polling fallback"" This reverts commit 6de4d9d.
nachocodoner
commented
Apr 16, 2025
nachocodoner
commented
Apr 16, 2025
Grubba27
approved these changes
Apr 16, 2025
italojs
approved these changes
Apr 18, 2025
…l repeated subscriptions to the same folder context
✅ Deploy Preview for v3-meteor-api-docs canceled.
|
…sion (keep performance gains)
…upported and covered by tests
Member
Author
|
Finally! This branch is ready to merge into 3.3. Next, I’ll test it more thoroughly across OS with all other changes in place. |
zodern
reviewed
Apr 23, 2025
zodern
reviewed
Apr 23, 2025
This was referenced Apr 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continues: #13657 and #13698
This PR continues the optimizations after switching to the SWC transpiler and dropping legacy compilation. It focuses on refactoring the file watchers used by Meteor, replacing them with a modern, native, and cross-platform tool: @parcel/watcher.
The change was suggested by @zodern. After reviewing the involved code, I found that Meteor used two libraries: Pathwatcher on Linux and vscode-NSFW on Windows/macOS. On Windows and macOS, Meteor enabled a single recursive watcher per directory using
vscode-nsfw, efficiently covering whole trees. On Linux, recursive watchers weren’t available, and adding one per subdirectory would overload the system. To avoid that, Meteor used `pathwatcher, watching files and some directories individually. This added up to 5 seconds of delay in Linux when reacting to file changes, especially for new files.The @parcel/watcher library offers a modern solution for recursive watching across platforms. It uses native backends: FSEvents (macOS), inotify or Watchman (Linux), and the Windows API. All through a unified interface. It supports recursive watching on all platforms, which is the key improvement here.
Results can be seen using
METEOR_MONITOR_PROCESS=trueinmeteor profile. This outputs the full profile process. The “Meteor(Total)” time shows only what the internal profiler sees, not including watcher reaction time. The new “Meteor(Progress)” output includes delays like startup wait and file change reactions. This metric helps confirm the improvements in this PR. See the next profiles for reference:It seems to have improved the prepareProjectForBuild phase, likely because it involves setting up file watching. There's also a slight improvement in build and rebuild times. In some profiles, the
safeWatcher.watchprocess appears as well.This still needs more testing across all OS, but results so far look good.
./meteor --get-readyfails; possible memory leak or limit with @parcel/watcher?