bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...)


From: Stefan Monnier
Subject: bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...)
Date: Wed, 06 Aug 2014 13:26:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>       Given that switch-to-buffer returns its argument, /and/ given
>       that mapc returns the sequence it’s given, I suggest that the
>       (mapcar 'switch-to-buffer LIST) forms in lisp/files.el be
>       replaced with (mapc 'switch-to-buffer LIST), – if only to avoid
>       the unnecessary consing when the list is effectively copied in
>       the mapcar case.

Thanks, I think it's indeed a valid/correct optimization, but I really
dislike relying on mapc's return value (it really should not return any
value at all).

In this case, the optimization doesn't seem worth the inconvenient of
having a very unusual code (relying on mapc's return value), since
those few cons cells we save are drowned in the noise of all the
code run by switch-to-buffer.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]