emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 6c858c1 168/399: ivy.el (ivy--filter): Improve performance


From: Oleh Krehel
Subject: [elpa] master 6c858c1 168/399: ivy.el (ivy--filter): Improve performance with :matcher
Date: Sat, 20 Jul 2019 14:57:16 -0400 (EDT)

branch: master
commit 6c858c16b22a4699603bf077195127d16670ffdf
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy--filter): Improve performance with :matcher
    
    First try if caching is possible. This assumes that e.g.
    
        (funcall matcher "ab" candidates)
    
    is a subset of
    
        (funcall matcher "a" candidates)
---
 ivy.el | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index 423c2ec..fe1b865 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3077,8 +3077,6 @@ CANDIDATES are assumed to be static."
              (matcher (ivy-state-matcher ivy-last))
              (case-fold-search (ivy--case-fold-p name))
              (cands (cond
-                      (matcher
-                       (funcall matcher re candidates))
                       ((and ivy--old-re
                             (stringp re)
                             (stringp ivy--old-re)
@@ -3090,10 +3088,9 @@ CANDIDATES are assumed to be static."
                                      ivy--old-re)
                                    re)
                                   '(0 2)))
-                       (ignore-errors
-                         (cl-remove-if-not
-                          (lambda (x) (string-match-p re x))
-                          ivy--old-cands)))
+                       (ivy--re-filter re ivy--old-cands))
+                      (matcher
+                       (funcall matcher re candidates))
                       (t
                        (ivy--re-filter re candidates)))))
         (if (memq (cdr (assq (ivy-state-caller ivy-last)



reply via email to

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