Skip to content

Instantly share code, notes, and snippets.

@alphapapa
Created December 19, 2018 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphapapa/32d7e89f443ea599d808f0b46a32b9ab to your computer and use it in GitHub Desktop.
Save alphapapa/32d7e89f443ea599d808f0b46a32b9ab to your computer and use it in GitHub Desktop.

--filter

(bench-multi :times 1000 :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)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value61.400.01209098000.0
with-current-bufferslowest0.74244280600.0
(bench-multi-lexical :times 1000 :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)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value76.370.00941710200.0
with-current-bufferslowest0.71914208900.0

cl-count

(bench-multi :times 1000 :ensure-equal t
  :forms (("buffer-local-value" (cl-count-if (lambda (buffer)
                                               (equal 'magit-status-mode (buffer-local-value 'major-mode buffer)))
                                             (buffer-list)))
          ("with-current-buffer" (cl-count-if (lambda (buffer)
                                                (equal 'magit-status-mode (with-current-buffer buffer
                                                                            major-mode)))
                                              (buffer-list)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value37.550.02183300400.0
with-current-bufferslowest0.81985193300.0
(bench-multi-lexical :times 1000 :ensure-equal t
  :forms (("buffer-local-value" (cl-count-if (lambda (buffer)
                                               (equal 'magit-status-mode (buffer-local-value 'major-mode buffer)))
                                             (buffer-list)))
          ("with-current-buffer" (cl-count-if (lambda (buffer)
                                                (equal 'magit-status-mode (with-current-buffer buffer
                                                                            major-mode)))
                                              (buffer-list)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value41.350.01979954300.0
with-current-bufferslowest0.818681665999999900.0

cl-loop

(bench-multi :times 1000 :ensure-equal t
  :forms (("buffer-local-value" (cl-loop for buffer in (buffer-list)
                                         count (equal 'magit-status-mode
                                                      (buffer-local-value 'major-mode buffer))))
          ("with-current-buffer" (cl-loop for buffer in (buffer-list)
                                          count (equal 'magit-status-mode
                                                       (with-current-buffer buffer
                                                         major-mode))))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value65.690.01219915400.0
with-current-bufferslowest0.80134276400.0
(bench-multi-lexical :times 1000 :ensure-equal t
  :forms (("buffer-local-value" (cl-loop for buffer in (buffer-list)
                                         count (equal 'magit-status-mode
                                                      (buffer-local-value 'major-mode buffer))))
          ("with-current-buffer" (cl-loop for buffer in (buffer-list)
                                          count (equal 'magit-status-mode
                                                       (with-current-buffer buffer
                                                         major-mode))))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value72.820.01103517899999999900.0
with-current-bufferslowest0.803621638000000100.0

cl-loop do

(bench-multi :times 1000 :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)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value72.360.01122445600.0
with-current-bufferslowest0.812197647000000100.0
(bench-multi-lexical :times 1000 :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)))))
Formx faster than nextTotal runtime# of GCsTotal GC runtime
buffer-local-value83.940.00951966200.0
with-current-bufferslowest0.79911966400.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment