Rudolf Adamkovič Personal site


Performance vs map functions

The dolist macro is

faster than the mapc function,

as it expands to while with inlined BODY

with no lamda indirection:
(macroexpand
 '(dolist (x '(10 20 30)) (* x 2)))
(let ((tail '(10 20 30)))
  (while tail (let ((x (car tail))) (* x 2) (setq tail (cdr tail)))))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.