{"action":"created","issue":{"url":"https://api.github.com/repos/guard/listen/issues/307","labels_url":"https://api.github.com/repos/guard/listen/issues/307/labels{/name}","comments_url":"https://api.github.com/repos/guard/listen/issues/307/comments","events_url":"https://api.github.com/repos/guard/listen/issues/307/events","html_url":"https://github.com/guard/listen/issues/307","id":73060257,"number":307,"title":"Recursion is used for OS X adapters when it need not be","user":{"login":"driskell","id":939815,"avatar_url":"https://avatars.githubusercontent.com/u/939815?v=3","gravatar_id":"","url":"https://api.github.com/users/driskell","html_url":"https://github.com/driskell","followers_url":"https://api.github.com/users/driskell/followers","following_url":"https://api.github.com/users/driskell/following{/other_user}","gists_url":"https://api.github.com/users/driskell/gists{/gist_id}","starred_url":"https://api.github.com/users/driskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/driskell/subscriptions","organizations_url":"https://api.github.com/users/driskell/orgs","repos_url":"https://api.github.com/users/driskell/repos","events_url":"https://api.github.com/users/driskell/events{/privacy}","received_events_url":"https://api.github.com/users/driskell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-04T16:04:38Z","updated_at":"2015-05-05T11:20:51Z","closed_at":null,"body":"Hello,\r\n\r\nOn OS X I've noticed recursion is used when an event is received. So even though events are received on a per folder basis it will recurse into them. This means if you copy in a large tree of files, it will recurse the tree exponentially dependent on depth. For example a simple 1/2/3/4/5 would mean a recursion over the 4/5 layer 3 times. It also means a single change to a file in the root triggers a recursion of the entire watched folder. If the folder contains thousands of folders/files it will then delay the next change by up to 10-15 seconds sometimes in the tests I've done while the CPU sits at 100%.\r\n\r\nIs there a reason for this recursion? Do any of the adapters (except poll) even need this at all?\r\n\r\n(On a separate note - I notice recursion is implied... the actual recursive flag passed by the adapters isn't even referenced.)\r\n\r\nThere is one reason I can think - and that is if a new folder is added - it would need to Directory.scan it in order to process its contents, thus it would (kind of) need to recurse into it. This can easily be made a special case, and full recursion only performed if requested (by polling adapter for example.)\r\n\r\nDoes this make sense? Have I misunderstood the code?"},"comment":{"url":"https://api.github.com/repos/guard/listen/issues/comments/99037511","html_url":"https://github.com/guard/listen/issues/307#issuecomment-99037511","issue_url":"https://api.github.com/repos/guard/listen/issues/307","id":99037511,"user":{"login":"driskell","id":939815,"avatar_url":"https://avatars.githubusercontent.com/u/939815?v=3","gravatar_id":"","url":"https://api.github.com/users/driskell","html_url":"https://github.com/driskell","followers_url":"https://api.github.com/users/driskell/followers","following_url":"https://api.github.com/users/driskell/following{/other_user}","gists_url":"https://api.github.com/users/driskell/gists{/gist_id}","starred_url":"https://api.github.com/users/driskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/driskell/subscriptions","organizations_url":"https://api.github.com/users/driskell/orgs","repos_url":"https://api.github.com/users/driskell/repos","events_url":"https://api.github.com/users/driskell/events{/privacy}","received_events_url":"https://api.github.com/users/driskell/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T11:20:51Z","updated_at":"2015-05-05T11:20:51Z","body":"I can also see once a directory is added to `Record::paths` it is never removed, only entries within each directory hash are removed in `_fast_unset_path`, so a tiny memory leak I guess."}}