GNU bug report logs -
#52209
28.0.60; [PATCH] date-to-time fails on pure dates
Previous Next
Full log
Message #114 received at 52209 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
From: Bob Rogers <rogers-emacs <at> rgrjr.homedns.org>
Date: Sun, 20 Feb 2022 17:14:36 -0500
From: Lars Ingebrigtsen <larsi <at> gnus.org>
Date: Sun, 20 Feb 2022 13:21:54 +0100
Bob Rogers <rogers-emacs <at> rgrjr.homedns.org> writes:
> Here's what I have for this phase of the plan; let me know what you
> think. It took longer than expected because it became a project unto
> itself, and so my procrastinator kicked in, making it longer still. :-/
:-)
Have you benchmarked your new implementation versus the current one?
It's important that the parsing is performant, otherwise it'd slow down
many things that parse a large number of date strings.
No benchmarking; I will do that presently.
Benchmarking code and results attached. I extracted a handful of
non-error cases from the tests as being more representative than any of
the error cases; the resulting numbers make it seem like any difference
between the two implementations is in the noise.
But this is my first foray into elisp benchmarking, so I may have
overlooked something. Fortunately, email dates are not that diverse, so
I am hoping this sampling may be broad enough.
-- Bob
[ietf-drums-date-timings.el (text/x-emacs-lisp, inline)]
;;; ietf-drums-date-timings.el --- timing ietf-drums-date.el -*- lexical-binding: t -*-
;; Copyright (C) 2022 Free Software Foundation, Inc.
;; Author: Bob Rogers <rogers <at> rgrjr.com>
(defun run-timings (parse-fn)
(dolist (case '(("Mon, 22 Feb 2016 19:35:42 +0100"
(42 35 19 22 2 2016 1 -1 3600)
(22219 21758))
("22 Feb 2016 19:35:42 +0100"
(42 35 19 22 2 2016 nil -1 3600)
(22219 21758))
("Mon, 22 February 2016 19:35:42 +0100"
(42 35 19 22 2 2016 1 -1 3600)
(22219 21758))
("Mon, 22 feb 2016 19:35:42 +0100"
(42 35 19 22 2 2016 1 -1 3600)
(22219 21758))
("Monday, 22 february 2016 19:35:42 +0100"
(42 35 19 22 2 2016 1 -1 3600)
(22219 21758))
("Monday, 22 february 2016 19:35:42 PST"
(42 35 19 22 2 2016 1 nil -28800)
(22219 54158))
("Friday, 21 Sep 2018 13:47:58 PDT"
(58 47 13 21 9 2018 5 t -25200)
(23461 22782))
("Friday, 21 Sep 2018 13:47:58"
(58 47 13 21 9 2018 5 -1 nil)
(23461 11982))))
(funcall parse-fn (car case))))
(benchmark-run-compiled 10000 (run-timings #'ietf-drums-parse-date))
;; (7.220905228 83 3.3420971879999968)
;; (7.24936647 83 3.3321491059999993)
;; (7.3240701370000005 84 3.371737411)
;; (/ (+ 7.249 7.324 7.324) 3) 7.299
(defun ietf-drums-old-parse-date (string)
"Return an Emacs time spec from STRING."
(encode-time (parse-time-string string)))
(benchmark-run 10000 (run-timings #'ietf-drums-old-parse-date))
;; (7.249068317 83 3.3251401939999994)
;; (7.317397244 84 3.3750772899999983)
;; (7.268244294 84 3.3820036280000005)
;; (/ (+ 7.249 7.317 7.268) 3) 7.278
This bug report was last modified 3 years and 173 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.