{"action":"created","issue":{"url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/71","repository_url":"https://api.github.com/repos/adrianlopezroche/fdupes","labels_url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/71/comments","events_url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/71/events","html_url":"https://github.com/adrianlopezroche/fdupes/issues/71","id":189020851,"number":71,"title":"Combine redundant code bits that only call stat()","user":{"login":"jbruchon","id":1005586,"avatar_url":"https://avatars1.githubusercontent.com/u/1005586?v=4","gravatar_id":"","url":"https://api.github.com/users/jbruchon","html_url":"https://github.com/jbruchon","followers_url":"https://api.github.com/users/jbruchon/followers","following_url":"https://api.github.com/users/jbruchon/following{/other_user}","gists_url":"https://api.github.com/users/jbruchon/gists{/gist_id}","starred_url":"https://api.github.com/users/jbruchon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbruchon/subscriptions","organizations_url":"https://api.github.com/users/jbruchon/orgs","repos_url":"https://api.github.com/users/jbruchon/repos","events_url":"https://api.github.com/users/jbruchon/events{/privacy}","received_events_url":"https://api.github.com/users/jbruchon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-14T03:23:35Z","updated_at":"2017-12-18T15:02:02Z","closed_at":null,"author_association":"NONE","body":"Several functions call `stat()` and only return a single value from the `struct stat` returned:\r\n```\r\nfilesize()\r\ngetdevice()\r\ngetinode()\r\ngetmtime()\r\ngetctime()\r\n```\r\nThere is also a `stat()` call at [line 327](https://github.com/adrianlopezroche/fdupes/blob/master/fdupes.c#L327) and a function `getfilestats()` which calls some of the `stat()` functions mentioned.\r\n\r\nThe overhead from redundant function calls and system `stat()` calls is heavy; for the 19 files and dirs in `testdir` using `fdupes -nrq testdir/` results in a total of 163 redundant `stat()` calls according to an `strace` log. On a different file tree with 1056 files and dirs, the excess `stat()` count shoots up to 38559.\r\n\r\nI propose combining all of these functions so that each file is `stat()`ed only one time, with the relevant `struct stat` items stored all at once."},"comment":{"url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/comments/352450059","html_url":"https://github.com/adrianlopezroche/fdupes/issues/71#issuecomment-352450059","issue_url":"https://api.github.com/repos/adrianlopezroche/fdupes/issues/71","id":352450059,"user":{"login":"golimarrrr","id":3762732,"avatar_url":"https://avatars0.githubusercontent.com/u/3762732?v=4","gravatar_id":"","url":"https://api.github.com/users/golimarrrr","html_url":"https://github.com/golimarrrr","followers_url":"https://api.github.com/users/golimarrrr/followers","following_url":"https://api.github.com/users/golimarrrr/following{/other_user}","gists_url":"https://api.github.com/users/golimarrrr/gists{/gist_id}","starred_url":"https://api.github.com/users/golimarrrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golimarrrr/subscriptions","organizations_url":"https://api.github.com/users/golimarrrr/orgs","repos_url":"https://api.github.com/users/golimarrrr/repos","events_url":"https://api.github.com/users/golimarrrr/events{/privacy}","received_events_url":"https://api.github.com/users/golimarrrr/received_events","type":"User","site_admin":false},"created_at":"2017-12-18T15:02:02Z","updated_at":"2017-12-18T15:02:02Z","author_association":"NONE","body":"That should be the reason why it's quite slow when used on files in network shares (tested for example against md5sum)"}}
{"actor":{"display_login":"golimarrrr"}}