bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12796: Optimize `ido-completing-read' for larger lists with flex mat


From: Leo
Subject: bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled
Date: Thu, 08 Nov 2012 15:36:23 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (OS X 10.8.2)

On 2012-11-08 12:14 +0800, Stefan Monnier wrote:
> Indeed.  This undesired behavior was introduced by the change to
> split-string introduced in Emacs-22, so the patch fixes a regression
> w.r.t Emacs-21.

Thanks for that information.

>
>> So do you mind installing the following small change for 24.3 that
>> greatly improves ido performance:
>
> I guess it's OK, yes.

Can I incorporate your suggestion on removing the backtracking issue? I
have found cases where flex matching perform badly but with your
suggestion, for example, cut the time from 4.8s to 0.3s.

The patch could look like this:

diff --git a/lisp/ido.el b/lisp/ido.el
index 31d5279d..0a740b2a 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3783,7 +3783,11 @@ (defun ido-set-matches-1 (items &optional do-full)
               ido-enable-flex-matching
               (> (length ido-text) 1)
               (not ido-enable-regexp))
-      (setq re (mapconcat #'regexp-quote (split-string ido-text "") ".*"))
+      (setq re (concat (regexp-quote (string (aref ido-text 0)))
+                      (mapconcat (lambda (c)
+                                   (concat "[^" (string c) "]*"
+                                           (regexp-quote (string c))))
+                                 (substring ido-text 1) "")))



Leo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]