mood-line/.repo-assets/benchmark.md

21 lines
715 B
Markdown
Raw Permalink Normal View History

2023-11-21 21:51:09 +00:00
```lisp
;; Emacs 29 with native compilation, default GC threshold
2023-11-21 21:54:50 +00:00
;; Run in a lisp-interaction-mode buffer with Flymake
2023-11-21 21:51:09 +00:00
(defun time-mode-line (num &optional and-mem)
(let ((gc-cons-threshold (if and-mem gc-cons-threshold most-positive-fixnum))
(start-time (current-time)))
(cl-loop for i to num
do (format-mode-line mode-line-format))
2023-12-07 01:15:14 +00:00
(format-time-string "%s.%3N seconds" (time-since start-time))))
2023-11-21 21:51:09 +00:00
;; Default mode line:
2023-12-07 01:15:14 +00:00
(time-mode-line 10000) ;; "0.440 seconds"
(time-mode-line 10000 :and-mem) ;; "2.402 seconds"
2023-11-21 21:51:09 +00:00
;; mood-line (default settings):
(mood-line-mode t)
2023-12-07 01:15:14 +00:00
(time-mode-line 10000) ;; "0.309 seconds"
(time-mode-line 10000 :and-mem) ;; "1.286 seconds"
2023-11-21 21:51:09 +00:00
```