Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: dolist vs. while-loop (was Re: epg and expired recipient keys)
Date: Thu, 08 Mar 2007 10:06:26 +0900	[thread overview]
Message-ID: <b4mslcgpmr1.fsf_-_@jpl.org> (raw)
In-Reply-To: <87k5xs26v2.fsf@catnip.gol.com>

>>>>> In <87k5xs26v2.fsf@catnip.gol.com> Miles Bader wrote:

> Miles Bader <miles@gnu.org> writes:

>> That isn't true in general; it may be true if you're using cl.el's
>> craptastic version of dolist.  Unfortunately, gnus uses cl, so I guess
>> it loses there...
>>
>> [The non-cl version of dolist is a macro that expands to basically the
>> same code as your hand-written while loop.]

> BTW, to be fair to cl.el, I think it tries to do additional tricks at
> compilation time to get rid of the additional overhead of its version of
> dolist (by removing unnecessary calls to catch/throw that its macro
> previously inserted to emulate common-lisp blocks).  I don't know how
> effective this is though.

Yes, there's no difference between the byte codes of the subr.el
version and the cl-macs.el version except for variable names.
But I don't know in what case and for what purpose the byte code
of the cl-macs.el version will have the catch-throw form.  That
is a mystery.

BTW, the results of the benchmark tests I wrote were done in
XEmacs 21.4.20 (<b4modn7q9jr.fsf@jpl.org>).  In Emacs 22 (in the
same host), I got:

[while loop]
1.0685009956359863
1.074789047241211
1.0869169235229492
1.1011860370635986
1.0744349956512451

[dolist]
1.122694969177246
1.1409659385681152
1.140753984451294
1.1298248767852783
1.1383061408996582

I also used Lars' benchmark.el.  Please note that the later test
has nested two dolist forms like the one that Wolfram Fenske wrote.
I guess the reason it is slower than the while-loop version is that
the `let' form in the inside dolist is used many times.

Regards,



  reply	other threads:[~2007-03-08  1:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 13:02 epg and expired recipient keys Michael Piotrowski
2007-02-24 16:00 ` Werner Koch
2007-02-26 10:37   ` Michael Piotrowski
     [not found]   ` <smutzxbtsam.fsf@linuxpal.mit.edu>
2007-02-26 12:23     ` Werner Koch
2007-02-26 12:49       ` Daiki Ueno
2007-02-26 14:31         ` Werner Koch
2007-02-27 11:23           ` Michael Piotrowski
2007-02-28 22:23           ` Daiki Ueno
2007-03-06  2:19             ` Wolfram Fenske
2007-03-06  4:29               ` Katsumi Yamaoka
2007-03-06  9:41                 ` Wolfram Fenske
2007-03-07 19:19                 ` Miles Bader
2007-03-07 19:25                   ` Miles Bader
2007-03-08  1:06                     ` Katsumi Yamaoka [this message]
2007-03-08 14:55                       ` dolist vs. while-loop (was Re: epg and expired recipient keys) Miles Bader
2007-03-06  4:40               ` epg and expired recipient keys Daiki Ueno
2007-03-06  9:37                 ` Wolfram Fenske

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=b4mslcgpmr1.fsf_-_@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).