From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/71477 Path: news.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: Re: Speeding up IMAP parsing Date: Wed, 22 Sep 2010 17:08:24 -0400 Message-ID: <87mxr91o6v.fsf@uwo.ca> References: <87k4mek2ow.fsf@uwo.ca> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1285189741 3371 80.91.229.12 (22 Sep 2010 21:09:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 22 Sep 2010 21:09:01 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M19850@lists.math.uh.edu Wed Sep 22 23:08:59 2010 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.69) (envelope-from ) id 1OyWYk-0004lT-4h for ding-account@gmane.org; Wed, 22 Sep 2010 23:08:58 +0200 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 1OyWYe-00072b-DZ; Wed, 22 Sep 2010 16:08:52 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1OyWYc-00072M-Qk for ding@lists.math.uh.edu; Wed, 22 Sep 2010 16:08:50 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1OyWYY-0004kq-DF for ding@lists.math.uh.edu; Wed, 22 Sep 2010 16:08:50 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1OyWYX-0007BM-00 for ; Wed, 22 Sep 2010 23:08:45 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OyWYV-0004eg-LX for ding@gnus.org; Wed, 22 Sep 2010 23:08:43 +0200 Original-Received: from bas3-london14-1096786111.dsl.bell.ca ([65.95.160.191]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Sep 2010 23:08:43 +0200 Original-Received: from jdc by bas3-london14-1096786111.dsl.bell.ca with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Sep 2010 23:08:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 73 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: bas3-london14-1096786111.dsl.bell.ca User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:F54Ii7bI1VUSaKRUDsbz0L7G4KI= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:71477 Archived-At: --=-=-= Content-Type: text/plain Lars Magne Ingebrigtsen writes: > Looking at the rfc, the % character isn't valid in the flags, but it has > char syntax for the `read' command, so substing \ with % before reading > should do the trick (and be really fast). I did a timing comparison between my Dec 2009 version of Gnus and current git when entering an IMAP group with about 6500 articles. Dec 2009: 11.1 seconds git: 10.8 seconds Great! With the patch below applied, the time reduces further to 10.4 seconds. But I don't know if it will break things for others. (I've used it for several months now without noticing a problem.) Interestingly, with my Dec 2009 version, the patch below reduces the time from 11.1 to 10.5 seconds, a bigger change than with git, and almost matching the git+patch time. Did the older nnimap.el use the read trick? If not, then it must have been more efficient in some other way to come so close to the time that the current version uses. Dan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=time-date.patch diff --git a/lisp/time-date.el b/lisp/time-date.el index 5dbd08c..01132bc 100644 --- a/lisp/time-date.el +++ b/lisp/time-date.el @@ -97,20 +97,20 @@ and type 2 is the list (HIGH LOW MICRO)." (autoload 'timezone-make-date-arpa-standard "timezone") ;;;###autoload +;; `parse-time-string' isn't sufficiently general or robust. It fails +;; to grok some of the formats that timezone does (e.g. dodgy +;; post-2000 stuff from some Elms) and either fails or returns bogus +;; values. timezone-make-date-arpa-standard should help. (defun date-to-time (date) "Parse a string DATE that represents a date-time and return a time value. If DATE lacks timezone information, GMT is assumed." (condition-case () - (apply 'encode-time - (parse-time-string - ;; `parse-time-string' isn't sufficiently general or - ;; robust. It fails to grok some of the formats that - ;; timezone does (e.g. dodgy post-2000 stuff from some - ;; Elms) and either fails or returns bogus values. Lars - ;; reverted this change, but that loses non-trivially - ;; often for me. -- fx - (timezone-make-date-arpa-standard date))) - (error (error "Invalid date: %s" date)))) + (apply 'encode-time (parse-time-string date)) + (error (condition-case () + (apply 'encode-time + (parse-time-string + (timezone-make-date-arpa-standard date))) + (error (error "Invalid date: %s" date)))))) ;; Bit of a mess. Emacs has float-time since at least 21.1. ;; This file is synced to Gnus, and XEmacs packages may have been written --=-=-=--