branch: elpa/projectile
commit b9840f09bea90933accea9252a16d66b1df9d8d4
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Use hash set for deleted file removal in projectile-dir-files-alien
    
    The deleted file check used member inside seq-remove, which is O(n*m)
    where n is total files and m is deleted files.  Convert the deleted
    list to a hash set for O(1) lookups, making the overall operation O(n).
---
 projectile.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/projectile.el b/projectile.el
index b1c7c18299..a7f7de3f6a 100644
--- a/projectile.el
+++ b/projectile.el
@@ -1579,7 +1579,9 @@ IGNORED-DIRECTORIES may optionally be provided."
              (deleted (unless (and projectile-git-use-fd 
projectile-fd-executable)
                         (projectile-git-deleted-files directory))))
         (if deleted
-            (seq-remove (lambda (f) (member f deleted)) files)
+            (let ((deleted-set (make-hash-table :test 'equal :size (length 
deleted))))
+              (dolist (f deleted) (puthash f t deleted-set))
+              (seq-remove (lambda (f) (gethash f deleted-set)) files))
           files)))
      (t (projectile-files-via-ext-command directory 
(projectile-get-ext-command vcs))))))
 

Reply via email to