Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Optimize regexp build by Group Mail Splitting
@ 2013-12-28  3:53 Daniel Dehennin
  2014-02-01  0:17 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Dehennin @ 2013-12-28  3:53 UTC (permalink / raw)
  To: ding

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-01 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-28  3:53 [PATCH] Optimize regexp build by Group Mail Splitting Daniel Dehennin
2014-02-01  0:17 ` Lars Ingebrigtsen
2014-02-01 13:07   ` Daniel Dehennin

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).