Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Cc: Dave Love <fx@gnu.org>
Subject: Re: faster gnus-thread-latest-date
Date: Fri, 11 Dec 2009 17:03:17 -0500	[thread overview]
Message-ID: <871vj1184a.fsf@uwo.ca> (raw)
In-Reply-To: <87d42m2ozw.fsf@uwo.ca>

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

Here's another patch that I think should be applied.  When parsing a
date, it first tries parse-time-string, and only falls back to using
timezone-make-date-arpa-standard if parse-time-string gives an error.
This is about 4 times faster in my tests with good dates, and shaves
0.6s off of opening a summary buffer with 6000 articles.  I've cc'd 
Dave Love since I believe he introduced this.  If he can confirm that
the problematic dates he encountered triggered an error in
parse-time-string, then this patch should be ok.

Dan


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

Index: time-date.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/time-date.el,v
retrieving revision 7.18
diff -u -r7.18 time-date.el
--- time-date.el	9 Sep 2009 09:31:35 -0000	7.18
+++ time-date.el	11 Dec 2009 22:02:32 -0000
@@ -97,19 +97,19 @@
 (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."
   (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:[~2009-12-11 22:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 21:27 Dan Christensen
2009-12-08  3:35 ` Dan Christensen
2009-12-08  7:07   ` Katsumi Yamaoka
2009-12-08 19:14   ` Ted Zlatanov
2009-12-09  0:33     ` Dan Christensen
2009-12-10  3:03       ` Dan Christensen
2009-12-11  3:01         ` Dan Christensen
2009-12-11 22:03           ` Dan Christensen [this message]
2009-12-13 23:25             ` Dan Christensen
2009-12-14 16:18               ` Dave Love
2009-12-13 23:56           ` Dan Christensen
2010-01-02  2:09             ` Dan Christensen
2010-01-12 17:17               ` Reiner Steib
2010-06-09 13:42             ` Dan Christensen
2010-06-10  0:32               ` Katsumi Yamaoka
2010-06-10  8:42                 ` Gnus new commits (was: faster gnus-thread-latest-date) Ted Zlatanov
2009-12-13 10:29   ` faster gnus-thread-latest-date Daniel Pittman
2009-12-13 23:38     ` Dan Christensen

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=871vj1184a.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --cc=ding@gnus.org \
    --cc=fx@gnu.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).