unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, monnier@iro.umontreal.ca, 55205@debbugs.gnu.org
Subject: bug#55205: 28.1.50; completion--replace illegally mutates completion candidates
Date: Mon, 2 May 2022 20:35:56 +0200	[thread overview]
Message-ID: <337d4d1d-558e-f39b-49d7-93964b783bab@daniel-mendler.de> (raw)
In-Reply-To: <83y1zj4y8r.fsf@gnu.org>

On 5/2/22 19:53, Eli Zaretskii wrote:
>> Date: Mon, 2 May 2022 18:57:06 +0200
>> Cc: monnier@iro.umontreal.ca, larsi@gnus.org, 55205@debbugs.gnu.org
>> From: Daniel Mendler <mail@daniel-mendler.de>
>>
>>> Why is it justified in this case?  How is this case different from any
>>> other case?
>>
>> I am sure that Stefan can give you a more qualified answer than I can. I
>> also don't see a point in this discussion. What is your argument? Do you
>> want to prove me wrong about the issue?
> 
> I just asked a good-faith question.  Why not answer it?

I tried to answer. Stefan tried to answer. But these answers were not
heard. Fortunately there are more answers.

Avoiding mutation in this case is helpful for performance and
efficiency. For example assume that you have many many completion
candidate strings with attached text properties (thousands of them). If
we cannot be sure that the strings are left intact, we have to copy all
these strings first before passing them to the completion system. This
will lead to a noticeable slowdown and severe unnecessary load on the
garbage collector. This really affects the UI badly and noticeably for
the user.

For illustration - in the popular Swiper package (from GNU ELPA), there
is the `swiper` command which has a noticeable startup overhead when
searching through large files, such that it essentially becomes
unusable. This startup overhead is the consequence of allocating a
string for every line of the file.

Furthermore running Swiper multiple times consecutively will lead to
significant memory usage and a garbage collector pause a short while
after. Note that Swiper is not exactly the same scenario I mentioned
above, because the strings are newly allocated. But I want to illustrate
the cost of these allocations and their impact on the UI experience.

I hope this answer is more helpful than the other earlier answers.

Daniel





  reply	other threads:[~2022-05-02 18:35 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01  8:27 bug#55205: 28.1.50; completion--replace illegally mutates completion candidates Daniel Mendler
2022-05-01 11:53 ` Lars Ingebrigtsen
2022-05-01 12:17   ` Eli Zaretskii
2022-05-01 20:11     ` Dmitry Gutov
2022-05-02  2:23       ` Eli Zaretskii
2022-05-02  9:46         ` Dmitry Gutov
2022-05-02 14:27           ` Eli Zaretskii
2022-05-02 21:06             ` Dmitry Gutov
2022-05-02 16:01     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 16:24       ` Eli Zaretskii
2022-05-02 16:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 16:38           ` Daniel Mendler
2022-05-02 16:47             ` Eli Zaretskii
2022-05-02 16:43           ` Eli Zaretskii
2022-05-02 16:48             ` Daniel Mendler
2022-05-02 16:53               ` Eli Zaretskii
2022-05-02 16:57                 ` Daniel Mendler
2022-05-02 17:53                   ` Eli Zaretskii
2022-05-02 18:35                     ` Daniel Mendler [this message]
2022-05-02 21:18                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 12:40   ` Daniel Mendler
2022-05-01 12:49     ` Eli Zaretskii
2022-05-01 12:54       ` Daniel Mendler
2022-05-01 13:16         ` Eli Zaretskii
2022-05-01 13:19           ` Daniel Mendler
2022-05-01 13:21             ` Daniel Mendler
2022-05-01 12:50     ` Daniel Mendler
2022-05-01 17:07   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 17:26     ` Lars Ingebrigtsen
2022-05-01 17:36       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 17:48         ` Lars Ingebrigtsen
2022-05-01 18:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 18:27       ` Daniel Mendler
2022-05-01 18:39         ` Lars Ingebrigtsen
2022-05-01 19:01           ` Daniel Mendler
2022-05-01 19:07             ` Lars Ingebrigtsen
2022-05-01 20:52               ` Dmitry Gutov
2022-05-01 20:54                 ` Lars Ingebrigtsen
2022-05-01 21:30                   ` Dmitry Gutov
2022-05-01 21:43                     ` Lars Ingebrigtsen
2022-05-02  6:31           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02  8:11             ` Lars Ingebrigtsen
2022-05-02  9:00               ` Daniel Mendler
2022-05-02 12:23               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-03 10:13                 ` Lars Ingebrigtsen
2022-05-03 12:55                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-04  7:48                     ` Lars Ingebrigtsen
2022-05-04  8:24                       ` Daniel Mendler
2022-05-04  8:51                         ` Daniel Mendler
2022-05-02  8:49             ` Daniel Mendler
2022-05-02  9:04               ` Lars Ingebrigtsen
2022-05-02  9:57                 ` Daniel Mendler
2022-05-02 10:07                   ` Lars Ingebrigtsen
2022-05-02 10:17                     ` Daniel Mendler
2022-05-01 17:39     ` Eli Zaretskii
2022-05-01 18:06     ` Daniel Mendler
2022-05-02  0:34   ` Richard Stallman

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=337d4d1d-558e-f39b-49d7-93964b783bab@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=55205@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.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 public inbox

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

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