branch: elpa/git-commit
commit 72e6631ca24d078c97603a26c1e07dda8fd5e108
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-run-hook-with-benchmark: Report time for individual functions
---
 lisp/magit-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 2548bb7b7b..4c658e024b 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -31,6 +31,7 @@
 (require 'magit-base)
 (require 'magit-git)
 
+(require 'benchmark)
 (require 'browse-url)
 (require 'format-spec)
 (require 'help-mode)
@@ -1457,7 +1458,10 @@ The additional output can be found in the *Messages* 
buffer."
     (if magit-refresh-verbose
         (let ((start (current-time)))
           (message "Running %s..." hook)
-          (run-hooks hook)
+          (run-hook-wrapped
+           hook
+           (lambda (fn)
+             (message "  %-50s %f" fn (benchmark-elapse (funcall fn)))))
           (message "Running %s...done (%.3fs)" hook
                    (float-time (time-subtract (current-time) start))))
       (run-hooks hook))))

Reply via email to