From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: epg and expired recipient keys
Date: Tue, 06 Mar 2007 13:29:28 +0900 [thread overview]
Message-ID: <b4modn7q9jr.fsf@jpl.org> (raw)
In-Reply-To: <867itvcdve.fsf@hondo.cadr.de>
>>>>> In <867itvcdve.fsf@hondo.cadr.de> Wolfram Fenske wrote:
> How about a version that uses the "dolist" macro? I think this makes
> the code a lot clearer. Plus, it's shorter.
> (defun mml2015-epg-find-usable-key (keys usage)
> (catch 'found
> (dolist (key keys)
> (dolist (sub (epg-key-sub-key-list key))
> (when (and (memq usage (epg-sub-key-capability sub))
> (not (memq (epg-sub-key-validity sub) '(revoked expired))))
> (throw 'found key))))))
It looks good and will probably make the code slow not so much.
I mean dolist is generally slower than well-designed while loop.
For instance:
(benchmark
10000
(let ((alist mm-mime-mule-charset-alist)
sub rest)
(while alist
(setq sub (car alist))
(while sub
(setq rest (cons (car sub) rest)
sub (cdr sub)))
(setq alist (cdr alist)))
(nreverse rest)))
0.5125889778137207
0.5080130100250244
0.5140340328216553
0.5127580165863037
0.5110170841217041
(benchmark
10000
(let (rest)
(dolist (sub mm-mime-mule-charset-alist (nreverse rest))
(dolist (elem sub)
(setq rest (cons elem rest))))))
0.6363399028778076
0.6323390007019043
0.6358840465545654
0.6289501190185547
0.6397740840911865
I used Lars' benchmark.el[1] and XEmacs 21.4.20 for those tests.
[1] http://quimby.gnus.org/elisp/benchmark.el
next prev parent reply other threads:[~2007-03-06 4:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-23 13:02 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 [this message]
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 ` dolist vs. while-loop (was Re: epg and expired recipient keys) Katsumi Yamaoka
2007-03-08 14:55 ` 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=b4modn7q9jr.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).