all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "João Távora" <joaotavora@gmail.com>
Cc: Daniel Mendler <mail@daniel-mendler.de>, 48545@debbugs.gnu.org
Subject: bug#48545: 28.0.50; `icomplete-vertical-mode` does not support the `group-function`
Date: Fri, 20 Aug 2021 02:51:15 +0300	[thread overview]
Message-ID: <c3f743eb-cf8b-10bf-a9ac-04bd3c0014be@yandex.ru> (raw)
In-Reply-To: <CALDnm51taxxujsqHg77QuM=2Hd3GuXYgSKqqX3NGXXgTNXVzSQ@mail.gmail.com>

On 20.08.2021 02:39, João Távora wrote:

>     Not sure I understand. Grouping is a linear operation, isn't it? O(N).
> 
> 
>     Which is generally cheaper than the sorting step that came before.
> 
> 
> Yes, but you'd be adding to it and that is always worse than _not_ 
> adding to it.

True, but since sorting has higher complexity, for large N it should 
take much longer, and for small N anything is fast anyway.

> And there's a constant factor in front of that O(N). So 
> that's why I think measurements should be taken, always.

Please go ahead, if you like. I just wanted to make a couple of 
suggestions here.

> Not to mention that if the table is already "naturally" grouped upfront, 
> your're incurring in both the sorting cost and the grouping cost, when 
> you could just be skipping both with little to no downsides, I would 
> presume.

Right. I just don't think either is costly, most of the time.

> Of course, maybe I presume wrong, but Kévins report, who does use 
> completions-group, seems to confirm it.

Performance degradation? Guess I missed it.

>     Could be it misses information.
> 
> 
> ? Don't understand this...

Maybe I should say: destroys information. One conveyed by the original 
sorting order.

>     OTOH, if you split completions belonging to the same group apart, you
>     can end up with a list where there as as many group headers, as there
>     completions (in the extreme case).
> 
> 
> That's true. That's why my idea is to skip sorting altogether when 
> tables have a group-function, under the assumption that good speed 
> matters much more than applying the default sorting within each group.
> 
> For example, what does it matter to have a recently chosen UTF-8 
> completion bubble up to the top of a group that's buried deep down in 
> the long list of groups? Not much, I think. And largely the same for the 
> length and lexicographical sorting.

Suppose the sorting was performed by the 'flex' style (as one example).

Then, at the very least, you will see at the top of the first group the 
best available match for your input. That's useful, I think. Even if the 
remaining items in that group are much worse matches.

>     What behavior does (setq completions-group t) have? 
> 
> 
> Seems to be a flag that controls the presence of 'group-function' in 
> some tables. Can't speak of the other UIs, but icomplete just honors 
> 'group-function' and does not double check the flag. It could, if it 
> were relevant, I guess.
> 
>     It affects the default UI, IIUC.
> 
> 
> Yes, I believe so. But what is the relevance?

icomplete's grouping behavior should probably match the default UI's 
behavior in that regard. Or, if people actually don't like it, see it 
changed in both places.





  reply	other threads:[~2021-08-19 23:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 18:56 bug#48545: 28.0.50; `icomplete-vertical-mode` does not support the `group-function` Daniel Mendler
2021-08-17 12:17 ` João Távora
2021-08-18  9:38   ` Kévin Le Gouguec
2021-08-18  9:55     ` João Távora
2021-08-19 11:18       ` João Távora
2021-08-19 12:38         ` Kévin Le Gouguec
2021-08-19 13:29           ` João Távora
2021-08-19 19:36             ` Kévin Le Gouguec
2021-08-19 15:02         ` Dmitry Gutov
2021-08-19 19:41           ` João Távora
2021-08-19 22:37             ` Dmitry Gutov
2021-08-19 23:39               ` João Távora
2021-08-19 23:51                 ` Dmitry Gutov [this message]
2021-08-20 10:35                   ` João Távora
2021-08-21  2:09                     ` Dmitry Gutov
2021-08-21  9:40                       ` João Távora
2021-08-21 12:01                         ` Dmitry Gutov
2021-08-21 12:42                           ` João Távora
2021-08-22 13:52                             ` Dmitry Gutov
2021-08-22 15:44                               ` João Távora
2021-08-21  0:24                   ` João Távora

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=c3f743eb-cf8b-10bf-a9ac-04bd3c0014be@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=48545@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=mail@daniel-mendler.de \
    /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.