branch: elpa/helm
commit 028cdd574eefedf9f6e2e45ce1c521c8243f40d0
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Speedup matching on large directories in HFF
    
    after typing first char.
---
 helm-files.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 68cf3feb299..eecdb3a8ac5 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3974,9 +3974,14 @@ If PATTERN is a valid directory name, return PATTERN 
unchanged."
                ;; bn as well.
                (regexp-quote bn)))
       (t (concat (regexp-quote bd)
-                 (if (>= (length bn) 2) ; wait 2nd char before concating.
+                 ;; wait 2nd char before transforming to fuzzy.
+                 (if (>= (length bn) 2)
                      (helm--mapconcat-pattern bn)
-                     (concat ".*" (regexp-quote bn))))))))
+                   ;; Here BN length is 1, we were previously matching
+                   ;; everything before BN i.e. (concat ".*" (regexp-quote bn))
+                   ;; but it is too slow on large directories. We could use
+                   ;; previous clause for this but keep it here for clarity.
+                   (regexp-quote bn)))))))
 
 (defalias 'helm-dir-is-dot 'helm-ff-dot-file-p)
 (make-obsolete 'helm-dir-is-dot 'helm-ff-dot-file-p "3.8.8")

Reply via email to