From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#55205: 28.1.50; completion--replace illegally mutates completion candidates Date: Mon, 2 May 2022 20:35:56 +0200 Message-ID: <337d4d1d-558e-f39b-49d7-93964b783bab@daniel-mendler.de> References: <4d1b8687-20f2-137a-2739-7bba28828991@daniel-mendler.de> <87wnf5mpt4.fsf@gnus.org> <835ymp78hl.fsf@gnu.org> <834k276gyd.fsf@gnu.org> <8335hr6g1n.fsf@gnu.org> <8f18460c-269f-40fb-bc69-a9c51671899a@daniel-mendler.de> <83zgjz511n.fsf@gnu.org> <8176b8ab-a949-6c57-3cc0-5be3bb1eb2df@daniel-mendler.de> <83y1zj4y8r.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, monnier@iro.umontreal.ca, 55205@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 02 20:37:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlav1-0009Rd-KR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 May 2022 20:37:11 +0200 Original-Received: from localhost ([::1]:50208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlav0-0008TK-Kl for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 May 2022 14:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlaus-0008Sn-5N for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 14:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlaur-0002jA-Sf for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 14:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlaur-0003dG-OC for bug-gnu-emacs@gnu.org; Mon, 02 May 2022 14:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 May 2022 18:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55205 X-GNU-PR-Package: emacs Original-Received: via spool by 55205-submit@debbugs.gnu.org id=B55205.165151656813866 (code B ref 55205); Mon, 02 May 2022 18:37:01 +0000 Original-Received: (at 55205) by debbugs.gnu.org; 2 May 2022 18:36:08 +0000 Original-Received: from localhost ([127.0.0.1]:38000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlau0-0003ba-DR for submit@debbugs.gnu.org; Mon, 02 May 2022 14:36:08 -0400 Original-Received: from server.qxqx.de ([178.63.65.180]:41915 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlatx-0003b1-VI for 55205@debbugs.gnu.org; Mon, 02 May 2022 14:36:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OAUqPXs5MOaKH+4LkwFubgst5cYoIIghyR1DOFLbhQg=; b=G73lvCAtHjGknTvX3CIzieEHip 6YL1sOO31XsIMjHHx4gz6jqKCVUPV1/i9D1ooG+oqIxL8WUphc7Am1ytKASjdnmzugFzJH5BezEz7 BWsROz/HtJjfBtkVx593E9jv8Os6QEHMhWetWVfvYxU879nl6tI1E2842OlVEKzMKAaE=; Content-Language: en-US In-Reply-To: <83y1zj4y8r.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231278 Archived-At: 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 >> >>> 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