Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Subject: Re: Speeding up IMAP parsing
Date: Wed, 22 Sep 2010 17:08:24 -0400	[thread overview]
Message-ID: <87mxr91o6v.fsf@uwo.ca> (raw)
In-Reply-To: <m3d3s525ci.fsf@quimbies.gnus.org>

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: time-date.patch --]
[-- Type: text/x-diff, Size: 1590 bytes --]

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

  reply	other threads:[~2010-09-22 21:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22  0:29 Lars Magne Ingebrigtsen
2010-09-22  0:46 ` Lars Magne Ingebrigtsen
2010-09-22  1:05   ` Dan Christensen
2010-09-22 14:57     ` Lars Magne Ingebrigtsen
2010-09-22 21:08       ` Dan Christensen [this message]
2010-09-22 21:38         ` Lars Magne Ingebrigtsen
2010-09-22 22:44           ` Dan Christensen
2010-09-22 13:26 ` Ted Zlatanov
2010-09-22 14:58   ` Lars Magne Ingebrigtsen

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=87mxr91o6v.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --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).