Hi,
when trying to open a file on a somewhat slow nfs file system I always end up with a quite long pause ; interestingly, this does not happen with ido or ivy. I run it via the profiler (profiler-start, find-file and C-g once the prompted appeared, then profiler-report) and this is the output. The profiler manages to get quite a few samples in the selectrum routines while hardly anything in the case of e.g. ivy
EDIT: selectrum seams to go for all-completions while ivy has completion--twq-all?
selectrum:

ivy:

ido:

Interesting, thanks for the pointers! Maybe related: #210
Could you check with #335? I don't know if this fixes it I have no test case I could use.
Thank you for looking into this. The Pause is still there unfortunately.
Yes, it is not easy to test :-( I don't know how this could be reproduced in another setting.
Okay, ivy let binds deault-directory and calls the table with an empty string so I thought it might help. Could you M-x debug-on-entry completion--twq-all and post the backtrace?
This is now from ivy (I removed some file names and path, so there was a long list of files where now is only "zzzz1" etc. and I changed the pathname to "/vol/zzzzzzzz/" in the backtrace):
Debugger entered--entering a function:
nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (96 . counsel-file-jump-from-find) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :update-fn nil :sort nil :frame #<frame emacs@cloten 0x276a1d0> :window #<window 3 on zzzzzzzz> :buffer #<buffer zzzzzzzz> :text nil :action (1 ("o" counsel-find-file-action "default") ("i" ivy--action-insert "insert") ("w" ivy--action-copy "copy") ("j" find-file-other-window "other window") ("f" find-file-other-frame "other frame") ("b" counsel-find-file-cd-bookmark-action "cd bookmark") ("x" counsel-find-file-extern "open externally") ("r" counsel-find-file-as-root "open as root") ("R" find-file-read-only "read only") ("l" find-file-literally "open literally") ("k" counsel-find-file-delete "delete") ("c" counsel-find-file-copy "copy file") ("m" counsel-find-file-move "move or rename") ("d" counsel-find-file-mkdir-action "mkdir")) :unwind nil :re-builder ivy--regex-plus :matcher counsel--find-file-matcher :dynamic-collection nil :display-transformer-fn ivy-read-file-transformer :directory "/vol/zzzzzzzz/" :caller counsel-find-file :current nil :def nil :ignore t :multi-action nil :extra-props nil))
ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher :initial-input nil :action counsel-find-file-action :preselect nil :require-match confirm-after-completion :history file-name-history :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (67108960 lambda (&optional arg) "nil (nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (96 . counsel-file-jump-from-find) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :caller counsel-find-file)Thanks, ivy does not pass a predicate but otherwise it shouldn't be to different from what selectrum does. Hm...
I will try to remove the predicate, maybe this causes some unnecessary file access thought we don't access anything in the predicate itself.
I did the same for selectrum (completion--twq-all); seems to do some additional work?
Debugger entered--entering a function:
I updated the PR, could you recheck with the update?
yes, now it is instantanious, no pause :-)
Great!
I reverted the first attempt, just to be sure, could you recheck everything is still fixed for you?
Yes, still works with the default directory part removed. In general find-file seems much snappier now :-) great job!
I wonder if reading directories with Selectrum if that is still slow for you, when you use M-x dired (in some dir which has a comparable amount of directories as your file problem) is that slow?
Ah, I just discovered the table seem to special case file-directory-p so things should also be fine for dirs.
seems fine!