Earlier quoted context omitted.
>or is it simply an abstraction over inotify? Looks like it: https://github.com/e-dant/watcher/blob/989147b183ee0547d71a1...
`scan_directory` in the same file recursively iterates directories and no calls to `inotify_*` functions seem to be made; no grep matches in the project directory.
Show HN: Filesystem Watcher
31–40 of 80 posts
Re: Show HN: Filesystem Watcher
#32See also: sane - for node watchexec - rust based, static binary
Re: Show HN: Filesystem Watcher
#33Looking at Win32, it scans the whole directory periodically, right? I must miss something, but how can that be called efficient?
A proper benchmarking program is in the works, however manual testing does show only minimal resource usage.
For more, see this issue: https://github.com/e-dant/watcher/issues/10
Re: Show HN: Filesystem Watcher
#34Re: Show HN: Filesystem Watcher
#35Looks great! I'm wondering what operating systems are supported. I'm assuming Linux. What about macOS and Windows?
Re: Show HN: Filesystem Watcher
#36See also: sane - for node watchexec - rust based, static binary
1. No need to worry about which files to watch or ignoring build outputs.
2. Works with every project with no setup.
3. Easy to trigger a re-run without actually changing a file.
4. Always runs after all files are saved instead of starting after the first file is saved and racing the rest.
5. Infinitely scalable.
Re: Show HN: Filesystem Watcher
#37Re: Show HN: Filesystem Watcher
#38Option 1 uses a lot of CPU and memory (the map storing the paths being monitored could easily grow to be tens or even hundreds of megabytes if many files are being monitored, which is often the case in large source projects). I have seen tools that use polling with a 100ms interval continuously burn 50% of cpu monitoring a modest sized directory with tens of thousands of files.
Option 2 theoretically would use less memory and little to no cpu, but in practice, the story is more complicated. If you are using an inotify or kqueue like api, you will have to store handles for all of the paths that are being monitored, which can take a significant amount of memory. On macos, the file system events are not accurate in the sense that you can't trust the type of event. It doesn't reliably distinguish between creation and modification events. So if you want to know specifically what kind of event happened, you end up back in case 1 where you have to store an in memory representation of the file system and diff against the in memory representation and the current file system state when you detect an event. For some use cases, you may not care to distinguish between creations and modifications and can get away with a lower memory, but less accurate, solution.
In my experience, getting all of this right is much more difficult than it appears at first glance. Good luck to you.
Re: Show HN: Filesystem Watcher
#39Earlier quoted context omitted.
My chrome browser.
> instant local search still checks out :) But I checked just to be sure and no warning in Version 106.0.5249.91 (Official Build) (32-bit). Maybe its your corporate baby content web filter?
Re: Show HN: Filesystem Watcher
#40Looking at Win32, it scans the whole directory periodically, right? I must miss something, but how can that be called efficient?