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 initial set up of watches takes exponential time in the number of directories to such a degree it would take approximately 30 hours to set up watches on 100,000 directories on my laptop.
I can't test it right now, but I suspect the culprit is line 1855 in pyinotify.py (under python2) (1842 under python3):
ifself.get_wd(rpath) isnotNone:
# We decide to ignore paths already inserted into# the watch manager. Need to be removed with rm_watch()# first. Or simply call update_watch() to update it.continue
where it checks if a watch descriptor already exists for the directory.
It makes good sense to do when adding watches to dirs that could have been moved from elsewhere in a recursively watched dir, but in the initial set up of watches, if no moving/creating/deleting is being done, it just slows it down immensely. Should be doable in linear time.
So instead of removing this check altogether (if it is the culprit) I suggest a "static" flag or similar to disable the check on the initial watches setup when it is known that the hierarchy won't change during.
The text was updated successfully, but these errors were encountered:
According to the man page for inotify_add_watch ( http://www.kernel.org/doc/man-pages/online/pages/man2/inotify_add_watch.2.html ), calling it on an already watched dir doesn't create a new watch descriptor, it just returns the already set wd. With those two lines commented out, the add_watch function's return array will also include wds for dirs that were already watched. I can't see where the problem lies in that.
Is there any problem in returning all wds, even the ones that were already set?
The initial set up of watches takes exponential time in the number of directories to such a degree it would take approximately 30 hours to set up watches on 100,000 directories on my laptop.
I can't test it right now, but I suspect the culprit is line 1855 in pyinotify.py (under python2) (1842 under python3):
where it checks if a watch descriptor already exists for the directory.
It makes good sense to do when adding watches to dirs that could have been moved from elsewhere in a recursively watched dir, but in the initial set up of watches, if no moving/creating/deleting is being done, it just slows it down immensely. Should be doable in linear time.
So instead of removing this check altogether (if it is the culprit) I suggest a "static" flag or similar to disable the check on the initial watches setup when it is known that the hierarchy won't change during.
The text was updated successfully, but these errors were encountered: