Skip to content

Commit

Permalink
Merge 0e869a9 into a8900da
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Dec 29, 2018
2 parents a8900da + 0e869a9 commit 48eff67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions elisp-refs-bench.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

(require 'elisp-refs)
(require 'dash)
(require 'shut-up)

(defmacro elisp-refs--print-time (form)
"Evaluate FORM, and print the time taken."
`(progn
(message "Timing %s" ',form)
(-let [(total-time gc-runs gc-time)
(shut-up (benchmark-run 1 ,form))]
(cl-letf (((symbol-function #'message)
(lambda (_format-string) &rest _args)))
(benchmark-run 1 ,form))]
(message "Elapsed time: %fs (%fs in %d GCs)"
total-time
gc-time
Expand Down Expand Up @@ -47,7 +48,9 @@
"Report the total number of lines of code searched."
(interactive)
(let* ((loaded-paths (elisp-refs--loaded-paths))
(loaded-src-bufs (shut-up (-map #'elisp-refs--contents-buffer loaded-paths)))
(loaded-src-bufs (cl-letf (((symbol-function #'message)
(lambda (_format-string) &rest _args)))
(-map #'elisp-refs--contents-buffer loaded-paths)))
(total-lines (-sum (--map (with-current-buffer it
(line-number-at-pos (point-max)))
loaded-src-bufs))))
Expand Down
5 changes: 3 additions & 2 deletions test/elisp-refs-unit-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ whilst visiting that file."
(with-current-buffer ,buf-sym
(insert ,contents)
(set-syntax-table emacs-lisp-mode-syntax-table)
(shut-up (save-buffer))
,@body)
(cl-letf (((symbol-function #'message)
(lambda (_format-string) &rest _args)))
(save-buffer)))
(kill-buffer ,buf-sym)
(delete-file ,filename-sym)))))

Expand Down

0 comments on commit 48eff67

Please sign in to comment.