{"action":"created","issue":{"url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/390","repository_url":"https://api.github.com/repos/gorakhargosh/watchdog","labels_url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/390/labels{/name}","comments_url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/390/comments","events_url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/390/events","html_url":"https://github.com/gorakhargosh/watchdog/issues/390","id":196259655,"number":390,"title":"Watchdog detects changes half a second later than dsoprea/PyInotify under Linux","user":{"login":"Larivact","id":8731884,"avatar_url":"https://avatars.githubusercontent.com/u/8731884?v=3","gravatar_id":"","url":"https://api.github.com/users/Larivact","html_url":"https://github.com/Larivact","followers_url":"https://api.github.com/users/Larivact/followers","following_url":"https://api.github.com/users/Larivact/following{/other_user}","gists_url":"https://api.github.com/users/Larivact/gists{/gist_id}","starred_url":"https://api.github.com/users/Larivact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Larivact/subscriptions","organizations_url":"https://api.github.com/users/Larivact/orgs","repos_url":"https://api.github.com/users/Larivact/repos","events_url":"https://api.github.com/users/Larivact/events{/privacy}","received_events_url":"https://api.github.com/users/Larivact/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-18T05:52:03Z","updated_at":"2016-12-19T05:43:46Z","closed_at":null,"body":"I am working on a project where the file changes should be detected as soon as possible.\r\nI started out using watchdog since it's crossplatform and conveniently abstracts the filesystem events,\r\nbut I noticed that watchdog takes 0.5s longer than [dsoprea/PyInotify](https://github.com/dsoprea/PyInotify) to detect file changes. Is this just the price you have to pay for the abstraction? Or could watchdog be more optimized?\r\n\r\nCode I used for benchmarking:\r\n```python\r\nimport time\r\nimport watchdog.events\r\nimport watchdog.observers\r\n\r\nclass EventHandler(watchdog.events.FileSystemEventHandler):\r\n\tdef on_any_event(self, event):\r\n\t\tprint(time.time())\r\n\r\nobserver = watchdog.observers.Observer()\r\nobserver.schedule(EventHandler(), '.', recursive=True)\r\nobserver.start()\r\ninput()\r\n```\r\n\r\n```python\r\nimport time\r\nimport inotify.adapters\r\n\r\ni = inotify.adapters.InotifyTree(b'.')\r\n\r\nfor event in i.event_gen():\r\n\tif event and 'IN_CLOSE_WRITE' in event[1]:\r\n\t\tprint(time.time())\r\n```"},"comment":{"url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/comments/267886509","html_url":"https://github.com/gorakhargosh/watchdog/issues/390#issuecomment-267886509","issue_url":"https://api.github.com/repos/gorakhargosh/watchdog/issues/390","id":267886509,"user":{"login":"Larivact","id":8731884,"avatar_url":"https://avatars.githubusercontent.com/u/8731884?v=3","gravatar_id":"","url":"https://api.github.com/users/Larivact","html_url":"https://github.com/Larivact","followers_url":"https://api.github.com/users/Larivact/followers","following_url":"https://api.github.com/users/Larivact/following{/other_user}","gists_url":"https://api.github.com/users/Larivact/gists{/gist_id}","starred_url":"https://api.github.com/users/Larivact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Larivact/subscriptions","organizations_url":"https://api.github.com/users/Larivact/orgs","repos_url":"https://api.github.com/users/Larivact/repos","events_url":"https://api.github.com/users/Larivact/events{/privacy}","received_events_url":"https://api.github.com/users/Larivact/received_events","type":"User","site_admin":false},"created_at":"2016-12-19T05:43:46Z","updated_at":"2016-12-19T05:43:46Z","body":"Buffering all events when only `moved_from` needs to be matched with `moved_to` seems to be inefficient. Wouldn't it be better to only wait 0.5s when `moved_from` occurs?\r\n\r\nI don't get why my testing resulted in a 0.5s delay the timeouts all seem to be set to 1s.\r\nAnyway is there a way to disable the buffering if you don't need the move events to be merged?"}}
{"actor":{"display_login":"Larivact"}}