-
-
Notifications
You must be signed in to change notification settings - Fork 758
feat: support rspack native fs watcher #10658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
- Updated `Cargo.toml` to include the "time" feature for Tokio. - Refactored `WatcherDirectoriesAnalyzer` to use `WatchTarget` instead of `WatchInfo`. - Introduced `Executor` struct to manage file system event handling and aggregation. - Removed the old `WatcherExecutor` implementation and replaced it with the new `Executor`. - Improved `DiskWatcher` to manage watched paths more effectively. - Enhanced `Trigger` to facilitate dependency resolution for file system events. - Updated the `FsWatcher` struct to integrate the new `Executor` and streamline event processing. - Added detailed documentation for new and modified structs and methods.
9a5391a
to
dc9aea0
Compare
- Removed the PathRegister and its associated logic, replacing it with PathManager to manage paths, directories, and missing paths. - Introduced PathAccessor for accessing registered paths. - Updated Analyzer trait to work with the new PathAccessor. - Modified DiskWatcher to handle WatchPattern instead of raw paths. - Enhanced Executor to manage event execution with aggregate handling. - Updated NativeWatchFileSystem to include pause functionality and improved callback handling. - Added tests for PathManager and related structures to ensure correct functionality.
…and add native watcher support in test tools
CodSpeed Performance ReportMerging #10658 will improve performances by 21.32%Comparing 🎉 Hooray!
|
Benchmark | BASE |
HEAD |
Change | |
---|---|---|---|---|
⚡ | js@is css mod |
112.3 µs | 92.6 µs | +21.32% |
Testing in local, notify dependency will increment 200kb size on binary size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please provide some performance comparasion data with watchpack ?
…tails for `inlineConst` feature
… with added and removed properties
… instead of removedMissingDependencies
Summary
Motivartion
This PR introduces a native file system watcher (NativeWatchFileSystem) to replace NodeWatchFileSystem when enabled via experiments.nativeWatcher: true. The goal is to:
Improve performance during mass file changes (fixing #7490).
Reduce Rspack’s JS/Rust boundary overhead by moving file watching to Rust.
Key Changes
Performance Benefits
Solves watchpack lag when handling large-scale file changes (e.g., git checkout, mass updates).
Rust-native efficiency: Leverages notify for low-overchange detection.
Usage
Enable in rspack.config.js:
Checklist