(bench-lexical-binding :times 100 :ensure-equal t
:forms (("buffer-local-value" (cl-loop for buffer in (buffer-list)
do (buffer-local-value 'major-mode buffer)))
("with-current-buffer" (cl-loop for buffer in (buffer-list)
do (with-current-buffer buffer
major-mode)))))
Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
Lexical: buffer-local-value | 1.15 | 0.001108 | 0 | 0 |
Dynamic: buffer-local-value | 68.26 | 0.001278 | 0 | 0 |
Dynamic: with-current-buffer | 1.01 | 0.087236 | 0 | 0 |
Lexical: with-current-buffer | slowest | 0.088165 | 0 | 0 |
(bench-lexical-binding :times 100 :ensure-equal t
:forms (("buffer-local-value" (--filter (equal 'magit-status-mode (buffer-local-value 'major-mode it))
(buffer-list)))
("with-current-buffer" (--filter (equal 'magit-status-mode (with-current-buffer it
major-mode))
(buffer-list)))))
Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
Lexical: buffer-local-value | 1.25 | 0.001263 | 0 | 0 |
Dynamic: buffer-local-value | 55.53 | 0.001575 | 0 | 0 |
Lexical: with-current-buffer | 1.01 | 0.087464 | 0 | 0 |
Dynamic: with-current-buffer | slowest | 0.088230 | 0 | 0 |