From: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
To: ding@gnus.org
Subject: [PATCH] Optimize regexp build by Group Mail Splitting
Date: Sat, 28 Dec 2013 04:53:37 +0100 [thread overview]
Message-ID: <877gapocla.fsf@hati.baby-gnu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 3197 bytes --]
Hello,
Here is a patch[1] to optimize the regexps build by Group Mail
Splitting.
It's a little bit slower, as said in my tag message a 100 run benchmark
on 44 mail groups managed by Group Mail Splitting result in:
- master: Elapsed time: 2.205961s (0.792951s in 9 GCs)
- master+patch: Elapsed time: 2.547914s (1.069562s in 12 GCs)
Regards.
The following changes since commit 934f25f8d8801afe315722fd0b0b4ea14bcb1534:
Make split tracing work in nnimap groups, too (2013-12-26 17:39:39 +0100)
are available in the git repository at:
git://git.baby-gnu.net/gnus.git tags/feature/use-regexp-opt-in-gnus-group-split-fancy
for you to fetch changes up to 116ef38c9c0264d2f91b415d27bdece99118bd47:
Optimize regexp build by Group Mail Splitting (2013-12-28 04:33:56 +0100)
----------------------------------------------------------------
Use “regexp-opt” instead of building alternatives.
A 100 run benchmark on 44 mail groups managed by Group Mail Splitting
result in:
- master: Elapsed time: 2.205961s (0.792951s in 9 GCs)
- master+patch: Elapsed time: 2.547914s (1.069562s in 12 GCs)
----------------------------------------------------------------
Daniel Dehennin (1):
Optimize regexp build by Group Mail Splitting
lisp/gnus-mlspl.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lisp/gnus-mlspl.el b/lisp/gnus-mlspl.el
index 3947c67..5769dad 100644
--- a/lisp/gnus-mlspl.el
+++ b/lisp/gnus-mlspl.el
@@ -179,22 +179,22 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
(split-regexp (cdr (assoc 'split-regexp params)))
(split-exclude (cdr (assoc 'split-exclude params))))
(when (or to-address to-list extra-aliases split-regexp)
- ;; regexp-quote to-address, to-list and extra-aliases
- ;; and add them all to split-regexp
+ ;; regexp-opt to-address, to-list and extra-aliases
+ ;; and append split-regexp to the compiled regexp
(setq split-regexp
(concat
"\\("
- (mapconcat
- 'identity
- (append
- (and to-address (list (regexp-quote to-address)))
- (and to-list (list (regexp-quote to-list)))
- (and extra-aliases
- (if (listp extra-aliases)
- (mapcar 'regexp-quote extra-aliases)
- (list extra-aliases)))
- (and split-regexp (list split-regexp)))
- "\\|")
+ (regexp-opt
+ (remove nil
+ (append
+ (list
+ to-address
+ to-list)
+ (if (listp extra-aliases)
+ extra-aliases
+ (list extra-aliases)))))
+ (if split-regexp
+ (concat "\\|" split-regexp))
"\\)"))
;; Now create the new SPLIT
(push (append
Footnotes:
[1] http://git.baby-gnu.net/gitweb/gitweb.cgi?p=gnus.git;a=tag;h=refs/tags/feature/use-regexp-opt-in-gnus-group-split-fancy
--
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF
[-- Attachment #2: Type: application/pgp-signature, Size: 229 bytes --]
next reply other threads:[~2013-12-28 3:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-28 3:53 Daniel Dehennin [this message]
2014-02-01 0:17 ` Lars Ingebrigtsen
2014-02-01 13:07 ` Daniel Dehennin
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=877gapocla.fsf@hati.baby-gnu.org \
--to=daniel.dehennin@baby-gnu.org \
--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).