From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/64374 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: epg and expired recipient keys Date: Tue, 06 Mar 2007 13:29:28 +0900 Organization: Emacsen advocacy group Message-ID: References: <87649ro899.fsf@wheatstone.g10code.de> <87y7mlgl9f.fsf@wheatstone.g10code.de> <56d409a7-d8c0-4e74-be44-824f942fd4e5@well-done.deisui.org> <87zm71f0sl.fsf@wheatstone.g10code.de> <867itvcdve.fsf@hondo.cadr.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: sea.gmane.org 1173155490 14551 80.91.229.12 (6 Mar 2007 04:31:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2007 04:31:30 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M12898@lists.math.uh.edu Tue Mar 06 05:31:22 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1HORKb-0008I8-E0 for ding-account@gmane.org; Tue, 06 Mar 2007 05:31:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1HORJl-0003wa-W0; Mon, 05 Mar 2007 22:30:30 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1HORJk-0003wM-2R for ding@lists.math.uh.edu; Mon, 05 Mar 2007 22:30:28 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.63) (envelope-from ) id 1HORJd-0004ZR-TV for ding@lists.math.uh.edu; Mon, 05 Mar 2007 22:30:27 -0600 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1HORJc-0002a2-00 for ; Tue, 06 Mar 2007 05:30:20 +0100 Original-Received: from [66.225.201.151] (port=48895 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.63) (envelope-from ) id 1HORJ0-0007p7-Ju for ding@gnus.org; Mon, 05 Mar 2007 22:29:43 -0600 X-Hashcash: 1:20:070306:ding@gnus.org::yvpWHf39aeWbCyfk:00008/Dj X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.20 (linux) Cancel-Lock: sha1:B+JwrBdSCvTomjsgflXFm6bM2M8= X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.5 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:64374 Archived-At: >>>>> 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