Subject: Re: bug#48841: fido-mode is slower than ido-mode with similar settings

From: João Távora <[email-masked]>
Date: Mon, 14 Jun 2021 01:16:23 +0100

On Mon, Jun 14, 2021 at 1:08 AM Dmitry Gutov <[email-masked]> wrote:

> Anyway, I was just describing an easier way to benchmark the same effect
> (without having to hit the key sequence very quickly). Hope you or
> someone else find it useful.

Yes.  It is useful.  I didn't know about benchmark-progn.

> > I could
> > investigate, but since your measurements confirm the same tendency
> > anyway, I think this simple patch is what's needed to close this issue.
>
> Haven't tested it myself, but it looks like it will almost certainly work.
>
> > diff --git a/lisp/icomplete.el b/lisp/icomplete.el
> > index 08b4ef2030..5d37f47e7d 100644
> > --- a/lisp/icomplete.el
> > +++ b/lisp/icomplete.el
> > @@ -859,13 +859,14 @@ icomplete-completions
> >                  (base-size (prog1 (cdr last)
> >                               (if last (setcdr last nil))))
> >                  (most-try
> > -                (if (and base-size (> base-size 0))
> > -                    (completion-try-completion
> > -                     name candidates predicate (length name) md)
> > -                  ;; If the `comps' are 0-based, the result should be
> > -                  ;; the same with `comps'.
> > -                  (completion-try-completion
> > -                   name comps nil (length name) md)))
> > +                (and (not fido-mode) ; Fido avoids these expensive calculations.
>
> Perhaps predicate it on the value of icomplete-hide-common-prefix instead?
>
> fido-mode sets it to nil, and this way we retain a better level of
> abstraction, and better backward compatibility for vanilla
> icomplete-mode users.

This is a good idea, the level of abstraction.  But what is this
"common prefix" anyway?  Is it the the same as the "determ"
thing,  or the "[mplete...] dance" as I called it earlier.  Shouldn't
fido-mode then _hide_ it?

I'm confused, but if you're not, go ahead and make that more
abstract change instead of relying on fido-mode.

> Next step might be switching this var's default value to nil.

Also confused, but no objections.

João