all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: [Emacs-diffs] master b0e318d 2/2: Score flex-style completions according to match tightness
Date: Wed, 20 Mar 2019 23:25:08 +0000	[thread overview]
Message-ID: <CALDnm51Sf9r6B=Bcby-4QD8VsTFvbmMbySrxy7DE66qfWAJrHw@mail.gmail.com> (raw)
In-Reply-To: <e877f54a-c55f-074e-672c-fef1d0c890e8@yandex.ru>

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

[Again, sorry for the double email Dmitry]

On Wed, Mar 20, 2019 at 9:58 PM Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 20.03.2019 23:00, João Távora wrote:
> > but I do think that flex can be
> > made faster so that it is only, say 1.2x, slower than basic in the worst
> > case
>
> When collection contains very long strings (e.g. a list of project files
> with VCR cassettes, if you know what I mean), flex can unavoidably
> become noticeably slower.
>

Yes, but we've established that it's 2x slower than "basic" in the
worse cases of flex, at least for the collection in Emacs's
obarray, which is a nice benchmark:

(benchmark-run-compiled 5
  (let ((completion-styles '(flex)))
    (completion-all-completions "" obarray nil 0))); (6.105048999999999 15
3.9362529999999936)

(benchmark-run-compiled 5
  (let ((completion-styles '(basic)))
    (completion-all-completions "" obarray nil 0))); (3.322738 10
2.0635609999999787)

So it doesn't seem like an impossible task to make it as fast as "basic"
is now, especially for these cases of short input strings. For example,
since

(equal (let ((completion-styles '(flex)))
         (completion-all-completions "" obarray nil 0))
       (let ((completion-styles '(basic)))
         (completion-all-completions "" obarray nil 0)))

is t, the null-string case, which is probably trivial to optimize ;-),
would
bring a noticeable improvement to icomplete's UI, and probably
company's.

Of course for pathological (but reasonable) input, it will often
be much much slower, because by nature flex matches much
more candidates and manages around much more data.

(benchmark-run-compiled 5
  (let ((completion-styles '(flex)))
    (completion-all-completions "eeee" obarray nil 0))); (2.068143 5
1.151679999999999)

(benchmark-run-compiled 5
  (let ((completion-styles '(basic)))
    (completion-all-completions "eeee" obarray nil 0))); (0.333021 0 0.0)

(benchmark-run-compiled 5
  (let ((completion-styles '(flex)))
    (completion-all-completions "kill" obarray nil 0)));
(0.7081639999999999 1 0.26370900000000574)

(benchmark-run-compiled 5
  (let ((completion-styles '(basic)))
    (completion-all-completions "kill" obarray nil 0))); (0.444207 0 0.0)

So while the slowdown due to a larger amount of candidates is something
we probably won't get around easily, a significant part of the slowdown
seems to be the matching logic, and that can probably be optimized,
with nice user-visible consequences.
João

[-- Attachment #2: Type: text/html, Size: 3957 bytes --]

  reply	other threads:[~2019-03-20 23:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190213212413.868.40960@vcs0.savannah.gnu.org>
     [not found] ` <20190213212414.D6F4C209C6@vcs0.savannah.gnu.org>
2019-02-14 12:38   ` master e4896fc 1/2: Add a new 'flex' completion style Robert Pluim
2019-02-14 13:50     ` João Távora
2019-02-14 14:37       ` Eli Zaretskii
2019-02-14 14:40         ` João Távora
2019-02-14 14:47       ` Robert Pluim
2019-02-14 14:50         ` João Távora
2019-02-14 15:12           ` Robert Pluim
2019-02-14 15:22           ` Drew Adams
2019-02-14 14:29     ` Eli Zaretskii
2019-02-14 14:39       ` João Távora
     [not found] ` <20190213212415.148B9209D7@vcs0.savannah.gnu.org>
2019-03-16  1:13   ` [Emacs-diffs] master b0e318d 2/2: Score flex-style completions according to match tightness Dmitry Gutov
2019-03-16 13:02     ` João Távora
2019-03-16 13:19       ` Stefan Monnier
2019-03-16 14:25         ` João Távora
2019-03-17 18:06         ` Dmitry Gutov
2019-03-17 19:22           ` João Távora
2019-03-17 20:32             ` Dmitry Gutov
2019-03-17 21:46               ` João Távora
2019-03-18 14:26                 ` Dmitry Gutov
2019-03-18 14:42                   ` Dmitry Gutov
2019-03-18 14:49                     ` Stefan Monnier
2019-03-18 14:52                       ` Dmitry Gutov
2019-03-18 16:20                         ` Stefan Monnier
2019-03-18 15:13                       ` Who uses Icomplete-mode? " João Távora
2019-03-18 16:44                         ` Stefan Monnier
2019-03-18 21:08                         ` Who uses Icomplete-mode? Juri Linkov
2019-03-18 14:54                     ` [Emacs-diffs] master b0e318d 2/2: Score flex-style completions according to match tightness João Távora
2019-03-18 14:51                   ` João Távora
2019-03-18 17:18                     ` Dmitry Gutov
2019-03-20  9:59                       ` João Távora
2019-03-20 12:09                         ` Stefan Monnier
2019-03-20 21:00                           ` João Távora
2019-03-20 21:58                             ` Dmitry Gutov
2019-03-20 23:25                               ` João Távora [this message]
2019-03-21  1:14                                 ` Stefan Monnier
2019-03-21  1:20                                 ` Dmitry Gutov
2019-03-21  1:08                             ` Stefan Monnier
2019-03-17 17:51       ` Dmitry Gutov
2019-03-17 19:09         ` João Távora
2019-03-17 20:22           ` Dmitry Gutov
2019-03-17 21:27             ` João Távora
2019-03-18  0:38               ` Dmitry Gutov

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

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

  git send-email \
    --in-reply-to='CALDnm51Sf9r6B=Bcby-4QD8VsTFvbmMbySrxy7DE66qfWAJrHw@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.