emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master b0e318d 2/2: Score flex-style completions accor


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master b0e318d 2/2: Score flex-style completions according to match tightness
Date: Wed, 20 Mar 2019 21:14:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> 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)

Completing the empty string is the worst case for the "highlight" part,
but not for the actual filtering.  For the filtering, you may like to
try completing a string like "eeeeel": `basic` will very quickly return
the empty set, whereas flex may take a lot longer, especially if your
completion table contains some long strings with lots and lots of `e`s
in it but no `l` (that should be enough to trigger the exponential
behavior of the backtracking regexp matcher)


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]