[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 9f21e1d 06/18: Add a matching optimization
From: |
Oleh Krehel |
Subject: |
[elpa] master 9f21e1d 06/18: Add a matching optimization |
Date: |
Mon, 20 Apr 2015 12:39:03 +0000 |
branch: master
commit 9f21e1d5258382f6426b5a08cea5971a8e955ad4
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add a matching optimization
* ivy.el (ivy-completions): When the new regex `re' is a contains the
old regex `ivy--old-re', it must be true that all candidates that
match `re' are contained inside all candidates that match
`ivy--old-re', i.e. the pre-computed in the last step
`ivy--old-cands'.
This should speed up completion for large (~100k) amount of candidates,
for the particular case of regex simply being extended.
---
ivy.el | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/ivy.el b/ivy.el
index bd43883..ebbb186 100644
--- a/ivy.el
+++ b/ivy.el
@@ -550,13 +550,19 @@ NAME is a string of words separated by spaces that is
used to
build a regex.
CANDIDATES is a list of strings."
(let* ((re (ivy--regex name))
- (cands (if (and (equal re ivy--old-re)
- ivy--old-cands)
- ivy--old-cands
- (ignore-errors
- (cl-remove-if-not
- (lambda (x) (string-match re x))
- candidates))))
+ (cands (cond ((and (equal re ivy--old-re)
+ ivy--old-cands)
+ ivy--old-cands)
+ ((and ivy--old-re (eq 0 (cl-search ivy--old-re re)))
+ (ignore-errors
+ (cl-remove-if-not
+ (lambda (x) (string-match re x))
+ ivy--old-cands)))
+ (t
+ (ignore-errors
+ (cl-remove-if-not
+ (lambda (x) (string-match re x))
+ candidates)))))
(tail (nthcdr ivy--index ivy--old-cands))
(ww (window-width))
idx)
- [elpa] master updated (d4a79d3 -> 2f4c2c1), Oleh Krehel, 2015/04/20
- [elpa] master d2f754d 02/18: ivy.el (ivy-alt-done): Update for 0 candidates, Oleh Krehel, 2015/04/20
- [elpa] master 378ee58 03/18: Add "C-v" and "M-v" scrolling, Oleh Krehel, 2015/04/20
- [elpa] master f5a32bf 04/18: Add a command to grep the current git repo, Oleh Krehel, 2015/04/20
- [elpa] master 9f21e1d 06/18: Add a matching optimization,
Oleh Krehel <=
- [elpa] master a9a4e81 05/18: counsel.el (counsel-git-grep): Fix the default-directory, Oleh Krehel, 2015/04/20
- [elpa] master 539fe7d 07/18: ivy.el (ivy-completions): Fix an optimization, Oleh Krehel, 2015/04/20
- [elpa] master 23c0e6a 08/18: ivy.el (ivy-done): Update for non-matching file names, Oleh Krehel, 2015/04/20
- [elpa] master a94ca83 01/18: swiper.el: Add a work-around for window-start not being current, Oleh Krehel, 2015/04/20
- [elpa] master cafcfb9 10/18: Allow "C-." to jump to current symbol definition, Oleh Krehel, 2015/04/20
- [elpa] master d0f3826 11/18: ivy.el (ivy--preselect-index): Give priority to perfect match, Oleh Krehel, 2015/04/20
- [elpa] master 297008b 09/18: Allow to customize the file sorting order, Oleh Krehel, 2015/04/20
- [elpa] master 3282f78 13/18: Speed up the default file sorting even more, Oleh Krehel, 2015/04/20
- [elpa] master 525a19d 14/18: Propertize directories with ivy-subdir face, Oleh Krehel, 2015/04/20
- [elpa] master 10af5a6 16/18: ivy.el (ivy-done): Still expand "./" though, Oleh Krehel, 2015/04/20