unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tomas Volf <wolf@wolfsden.cz>
To: help-gnu-emacs@gnu.org
Subject: How to speed up ido-use-filename-at-point 'guess on large directories
Date: Fri, 27 Oct 2023 22:58:17 +0200	[thread overview]
Message-ID: <ZTwkaYHrvQjjlMkU@ws> (raw)

[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]

Hello,

I ran into an issue of C-x C-f being very slow when guessing the filename at
point if the file at point is located in a large directory (119765 entries).

My ido configuration:

    (require 'ido)
    (setq ido-enable-flex-matching t
          ido-enable-dot-prefix t
          ido-max-prospects 8
          ido-everywhere t
          ido-auto-merge-work-directories-length -1
          ido-create-new-buffer 'always
          ido-use-filename-at-point 'guess)
    (ido-mode 1)

I did manage to find ido-big-directories variable, so I also added this:

    (add-to-list 'ido-big-directories (rx "/gnu/store"))

That does seem to work, because trying to navigate into /gnu/store does tell me
[Too big].

However when I have a point over a filename inside the /gnu/store, for example
/gnu/store/a1252v3fav1fabl1qmbzyjl936prabir-foo, the ido-find-file takes a long
time (many seconds) before showing the prompt (with the file at point filled
in).

#emacs did advice me to use toggle-debug-on-quit, so I do have a backtrace:

    Debugger entered--Lisp error: (quit)
      #f(compiled-function () #<bytecode 0x1e3ca1a0816daf>)()
      ido-ignore-item-p("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar..." ("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./") t)
      #f(compiled-function (name) #<bytecode -0x1fcf4865f9f8d5f0>)("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar...")
      ido-make-file-list-1("/gnu/store/")
      ido-make-file-list(nil)
      ido-read-internal(file "Find file: " ido-file-history nil confirm-after-completion "a1252v3fav1fabl1qmbzyjl936prabir-foo")
      ido-file-internal(raise-frame)
      ido-find-file()
      funcall-interactively(ido-find-file)
      command-execute(ido-find-file)

It seems to be building a list of the files, I somewhat hoped the
ido-big-directories would prevent that.

Would someone have any idea how to make this faster?

Thank you and have a nice day,
Tomas Volf

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2023-10-27 20:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTwkaYHrvQjjlMkU@ws \
    --to=wolf@wolfsden.cz \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).