{"action":"created","issue":{"url":"https://api.github.com/repos/magit/magit/issues/2400","labels_url":"https://api.github.com/repos/magit/magit/issues/2400/labels{/name}","comments_url":"https://api.github.com/repos/magit/magit/issues/2400/comments","events_url":"https://api.github.com/repos/magit/magit/issues/2400/events","html_url":"https://github.com/magit/magit/pull/2400","id":117649727,"number":2400,"title":"Optimize refresh for large repos","user":{"login":"ewstearns","id":752459,"avatar_url":"https://avatars.githubusercontent.com/u/752459?v=3","gravatar_id":"","url":"https://api.github.com/users/ewstearns","html_url":"https://github.com/ewstearns","followers_url":"https://api.github.com/users/ewstearns/followers","following_url":"https://api.github.com/users/ewstearns/following{/other_user}","gists_url":"https://api.github.com/users/ewstearns/gists{/gist_id}","starred_url":"https://api.github.com/users/ewstearns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewstearns/subscriptions","organizations_url":"https://api.github.com/users/ewstearns/orgs","repos_url":"https://api.github.com/users/ewstearns/repos","events_url":"https://api.github.com/users/ewstearns/events{/privacy}","received_events_url":"https://api.github.com/users/ewstearns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-11-18T18:28:09Z","updated_at":"2015-12-06T16:28:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/magit/magit/pulls/2400","html_url":"https://github.com/magit/magit/pull/2400","diff_url":"https://github.com/magit/magit/pull/2400.diff","patch_url":"https://github.com/magit/magit/pull/2400.patch"},"body":"Making a list of tracked files for a refresh operation can take a long\r\ntime on large repos on remote paths.  Check file under top directory\r\nindivitually."},"comment":{"url":"https://api.github.com/repos/magit/magit/issues/comments/162327127","html_url":"https://github.com/magit/magit/pull/2400#issuecomment-162327127","issue_url":"https://api.github.com/repos/magit/magit/issues/2400","id":162327127,"user":{"login":"ewstearns","id":752459,"avatar_url":"https://avatars.githubusercontent.com/u/752459?v=3","gravatar_id":"","url":"https://api.github.com/users/ewstearns","html_url":"https://github.com/ewstearns","followers_url":"https://api.github.com/users/ewstearns/followers","following_url":"https://api.github.com/users/ewstearns/following{/other_user}","gists_url":"https://api.github.com/users/ewstearns/gists{/gist_id}","starred_url":"https://api.github.com/users/ewstearns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewstearns/subscriptions","organizations_url":"https://api.github.com/users/ewstearns/orgs","repos_url":"https://api.github.com/users/ewstearns/repos","events_url":"https://api.github.com/users/ewstearns/events{/privacy}","received_events_url":"https://api.github.com/users/ewstearns/received_events","type":"User","site_admin":false},"created_at":"2015-12-06T16:28:04Z","updated_at":"2015-12-06T16:28:04Z","body":"I used the following code to profile this:\r\n\r\n````elisp\r\n(defun profile-magit ()\r\n  (elp-restore-all)\r\n  (elp-instrument-package \"magit\")\r\n  (elp-reset-all)\r\n  (magit-revision-files \"HEAD\")\r\n  (elp-results))\r\n````\r\nFor current network conditions (at home, over VPN; worst case conditions for tramp) with current head (46143e4) over four runs: 52.785337, 35.618167, 25.768841, 53.236029 seconds.\r\n\r\nWith the following change:\r\n\r\n````\r\ndiff --git a/lisp/magit-git.el b/lisp/magit-git.el\r\nindex 1bbeaaa..912ea63 100644\r\n--- a/lisp/magit-git.el\r\n+++ b/lisp/magit-git.el\r\n@@ -490,7 +490,7 @@ tracked file.\"\r\n \r\n (defun magit-revision-files (rev)\r\n   (magit-with-toplevel\r\n-    (magit-git-items \"ls-tree\" \"-z\" \"-r\" \"--name-only\" rev)))\r\n+    (magit-git-lines \"ls-tree\" \"-r\" \"--name-only\" rev)))\r\n \r\n (defun magit-changed-files (rev-or-range &optional other-rev)\r\n   \"Return list of files the have changed between two revisions.\r\n````\r\nOver four runs:\r\n7.412256, 5.294956, 6.816468, 6.138879 seconds.\r\n\r\nWith my patch under the same network conditions, `(magit-refresh)` with no buffers open takes, over 4 runs:\r\n3.24654, 3.042895, 2.940799, 3.137578 seconds.\r\n\r\nUsing `git-ls-tree` without the `-z` option saves considerable time and should be used, but I think my patch should still be considered also for large repos because refresh operations would still be slow (about 10 seconds)."}}