From: Markus Triska <markus.triska@gmx.at>
To: Miles Bader <miles@gnu.org>
Cc: lekktu@gmail.com, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: weird desktop.el change
Date: Fri, 13 Apr 2007 19:02:07 +0200 [thread overview]
Message-ID: <87wt0g2oog.fsf@gmx.at> (raw)
In-Reply-To: <878xcycx95.fsf@catnip.gol.com> (Miles Bader's message of "Thu\, 12 Apr 2007 08\:22\:14 +0900")
Miles Bader <miles@gnu.org> writes:
> The process of substituting "mapc" for "mapcar" when the result
> isn't used is not only a hugely widespread tweak in the lisp
> community (a "no brainer" as you might call it), indeed it's an
> obvious optimization for even a very stupid lisp compiler...
Available with this patch:
2007-04-13 Markus Triska <markus.triska@gmx.at>
* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): rewrite
`mapcar' to `mapc' when called for effect
Index: byte-opt.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/byte-opt.el,v
retrieving revision 1.94
diff -c -r1.94 byte-opt.el
*** byte-opt.el 11 Apr 2007 17:10:42 -0000 1.94
--- byte-opt.el 13 Apr 2007 16:48:08 -0000
***************
*** 408,413 ****
--- 408,418 ----
(prin1-to-string clause))
clause))
(cdr form))))
+ ((and for-effect (eq fn 'mapcar))
+ (when (/= (length form) 3)
+ (byte-compile-warn "wrong number of arguments for `mapcar'"))
+ (byte-compile-warn "`mapcar' called for effect; using `mapc'")
+ (byte-optimize-form (cons 'mapc (cdr form)) for-effect))
((eq fn 'progn)
;; as an extra added bonus, this simplifies (progn <x>) --> <x>
(if (cdr (cdr form))
next prev parent reply other threads:[~2007-04-13 17:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 0:05 weird desktop.el change Miles Bader
2007-04-11 0:49 ` Juanma Barranquero
2007-04-11 1:25 ` Miles Bader
2007-04-11 1:58 ` Chong Yidong
2007-04-11 15:47 ` Stephen J. Turnbull
2007-04-11 19:46 ` Richard Matthew Stallman
2007-04-11 23:22 ` Miles Bader
2007-04-13 17:02 ` Markus Triska [this message]
2007-04-13 19:20 ` Stefan Monnier
2007-04-13 19:32 ` Markus Triska
2007-04-14 3:45 ` Richard Stallman
2007-04-15 2:36 ` Markus Triska
2007-04-15 19:01 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wt0g2oog.fsf@gmx.at \
--to=markus.triska@gmx.at \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=miles@gnu.org \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.