You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default behaviors of https://github.com/nextjournal/beholder and https://github.com/gmethvin/directory-watcher cause watched folders to register watches on all subfolders recursively, and 'watching' a folder reads and hashes every file within it at startup and rehashes any created/modified files on every modification. Due to this, the DirectoryWatcher created by watch-deps is reading and hashing everything under the project folder recursively (including .git, node_modules, etc) and rehashing all modified files even though the callback registered by watch-deps ultimately ignores everything but modifications to deps.edn. This can cause a long delay when watch-deps is invoked for projects with large numbers of files or just large files (e.g. data files under resources/) due the hashing on startup, and unnecessary resource usage caused by rehashing every git commit, asset file update, etc.
DirectoryWatcher can be configured not to hash or to use the file modified timestamp instead of hashing, but these options are not exposed by beholder. It doesn't appear to be possible to watch a single folder without its children using DirectoryWatcher
Would a PR that uses the native java.nio.file.WatchService directly instead of beholder/DirectoryWatcher be welcome? It appears the downside would be that WatchService uses a polling implementation on MacOS, but since it would be possible to watch the project root without any children, I would think it would still be a net win for performance.
The text was updated successfully, but these errors were encountered:
I'm inclined to say we should first try to keep hashing and just try to avoid hashing what we don't need to. It looks like DirectoryWatcher allows for setting a custom FileTreeVisitor, which I believe could do that filtering. But if that doesn't end up being very straightforward, dropping hashing is something to consider.
The default behaviors of https://github.com/nextjournal/beholder and https://github.com/gmethvin/directory-watcher cause watched folders to register watches on all subfolders recursively, and 'watching' a folder reads and hashes every file within it at startup and rehashes any created/modified files on every modification. Due to this, the
DirectoryWatcher
created bywatch-deps
is reading and hashing everything under the project folder recursively (including.git
,node_modules
, etc) and rehashing all modified files even though the callback registered bywatch-deps
ultimately ignores everything but modifications todeps.edn
. This can cause a long delay whenwatch-deps
is invoked for projects with large numbers of files or just large files (e.g. data files underresources/
) due the hashing on startup, and unnecessary resource usage caused by rehashing every git commit, asset file update, etc.DirectoryWatcher
can be configured not to hash or to use the file modified timestamp instead of hashing, but these options are not exposed by beholder. It doesn't appear to be possible to watch a single folder without its children usingDirectoryWatcher
Would a PR that uses the native
java.nio.file.WatchService
directly instead of beholder/DirectoryWatcher be welcome? It appears the downside would be thatWatchService
uses a polling implementation on MacOS, but since it would be possible to watch the project root without any children, I would think it would still be a net win for performance.The text was updated successfully, but these errors were encountered: