From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Protesilaos Stavrou <info@protesilaos.com>
Cc: Philip Kaludercic <philipk@posteo.net>, emacs-devel@gnu.org
Subject: Re: [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package
Date: Mon, 10 Jul 2023 17:13:54 -0400 [thread overview]
Message-ID: <jwvlefnmq3d.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87edlfbjsx.fsf@protesilaos.com> (Protesilaos Stavrou's message of "Mon, 10 Jul 2023 23:20:14 +0300")
>> - (when (and (bufferp buffer)
>> - (buffer-live-p buffer))
>> - buffer))
>> + (and (bufferp buffer)
>> + (buffer-live-p buffer)))
>> dired-preview--buffers))
>
> This is technically correct but more difficult to express intent.
BTW, `buffer-live-p` also accepts non-buffer arguments, so you can skip
the `bufferp` test.
>> (let ((size 0))
>> - (mapc
>> - (lambda (buffer)
>> - (setq size (+ (buffer-size buffer) size)))
>> - (dired-preview--get-buffers))
>> + (dolist (buffer (dired-preview--get-buffers))
>> + (setq size (+ (buffer-size buffer) size)))
>> size))
>
> Since we are here, what is the technical advantage of dolist over mapc?
> I have searched the docs for a clarification, but have not found one. I
> get that it looks tidier, but is there a performance boost or something?
It's like an inlined mapc, which makes it a bit more efficient, yes.
Stefan
next prev parent reply other threads:[~2023-07-10 21:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <168884609732.27984.6450580686777461843@vcs2.savannah.gnu.org>
[not found] ` <20230708195457.95F1AC11DD8@vcs2.savannah.gnu.org>
2023-07-08 21:47 ` [elpa] main 2ec80977e1: * elpa-packages (dired-preview): New package Stefan Monnier
2023-07-09 2:29 ` Protesilaos Stavrou
2023-07-10 18:29 ` Philip Kaludercic
2023-07-10 20:20 ` Protesilaos Stavrou
2023-07-10 21:13 ` Stefan Monnier [this message]
2023-07-11 7:47 ` Philip Kaludercic
2023-07-11 13:33 ` Stefan Monnier
2023-07-11 16:58 ` Philip Kaludercic
2023-07-11 18:45 ` Stefan Monnier
2023-07-13 18:40 ` Protesilaos Stavrou
2023-07-13 20:29 ` Philip Kaludercic
2023-07-13 21:36 ` Stefan Monnier
2023-07-14 8:13 ` Mattias Engdegård
2023-07-14 14:18 ` [External] : " Drew Adams
2023-07-14 19:29 ` Philip Kaludercic
2023-07-18 19:06 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvlefnmq3d.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=info@protesilaos.com \
--cc=philipk@posteo.net \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).