GNU bug report logs - #64391
30.0.50; buffer narrowing slowdown regression in emacs 29

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs,gnus; Reported by: Andrew Cohen <acohen@HIDDEN>; dated Sat, 1 Jul 2023 00:21:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 11:27:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 07:27:26 2023
Received: from localhost ([127.0.0.1]:42674 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHjcT-0007HJ-Tn
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 07:27:26 -0400
Received: from mail-lf1-f49.google.com ([209.85.167.49]:51561)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1qHjcO-0007H2-5p
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 07:27:24 -0400
Received: by mail-lf1-f49.google.com with SMTP id
 2adb3069b0e04-4fba86f069bso2805341e87.3
 for <64391 <at> debbugs.gnu.org>; Fri, 07 Jul 2023 04:27:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1688729234; x=1691321234;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject
 :date:message-id:reply-to;
 bh=J4/JDn8kt0/4t/Z5DHUtGExXFrmUnhqT8wXbEuL3ojQ=;
 b=Bp7/C6Uj/hQYRlEJ0WYQDrQfgYxVamq56RVoKB40ew3PQDIr2HU9upTxyg9IlwBI2U
 4yfmm8pJDnx7ER0yuerps2Z2LAc5wApFXuXx9gC/L/1lqlwAXJIp1FdD5Iwb8YlsJ6vK
 Qzn1UW/RMdM1znTgJhG6G8WXBjEb8vphATMcFm8y/v25G0fko9q24K78tME84mJ0Ebxs
 AQouwbATQuF9Umi3TwE18sfv1q+ct2uv2VaNLezXjcOEQyoz58bV6KlPU2DnIjT4nWN9
 FKAF0K5v2d8zBvajvfo03NswH74mC9MUQ10pDeAYah/BXKvooOWS6udA6bnyl3IAEIfO
 dW5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1688729234; x=1691321234;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=J4/JDn8kt0/4t/Z5DHUtGExXFrmUnhqT8wXbEuL3ojQ=;
 b=dcaEOG+hKZWeIBR078ByxR3QxEeW5sWJ8ThYBg+wCplS3b720b8vjoELdfhGOFS8tm
 XsnhnF8pf7FdySak7hVa+5rVCblSL0aH3+j08GevtDUGECmPrsl1VwfaI9WZq0+OVDgZ
 QUaxjkgc83T4WN+E9NFXoZPEEdefKWc4VqXF5F63R+5qANv/QU/U1uxrlnSO2WRKLggY
 CMD8/q2MyV1N1N75gzjIJeO315F8Nqa4oYqMrt+aY3/FyeiKgL9dr9AWlXWeeZLPuayy
 2NzHohP3/veP9x6DcEfaptgvt66d67ewCDP67D6BRBbMnYvsyn2KY8jlL0pE8Vs4U4tM
 77yw==
X-Gm-Message-State: ABy/qLYGj4E3CnoYHTHEuulqg0Xnts8UO5lRVaiDwDWzxSkOUOBrB70n
 Dd2LH+nIvBPiATWwHqUCy28=
X-Google-Smtp-Source: APBJJlGCK5WD1doLv4WsCtE2TWGCU4oQl3fNBWUDQekpij43AotS5FGdFA5MGth67KbUN+pm4Y+ToQ==
X-Received: by 2002:a05:6512:b8c:b0:4f8:6ea5:104b with SMTP id
 b12-20020a0565120b8c00b004f86ea5104bmr4663640lfv.30.1688729233770; 
 Fri, 07 Jul 2023 04:27:13 -0700 (PDT)
Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se.
 [188.150.165.235]) by smtp.gmail.com with ESMTPSA id
 n24-20020a195518000000b004eb0c51780bsm651010lfe.29.2023.07.07.04.27.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 07 Jul 2023 04:27:13 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <83ttugf234.fsf@HIDDEN>
Date: Fri, 7 Jul 2023 13:27:12 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <02BAD0BC-4050-4A57-B22B-2D970A8386C3@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN> <26cee506f70bbc9de58b@HIDDEN>
 <83h6qghpdc.fsf@HIDDEN> <26cee506f77e9c87e325@HIDDEN>
 <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN> <83ttugf234.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, gregory@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

7 juli 2023 kl. 12.27 skrev Eli Zaretskii <eliz@HIDDEN>:

> I was considering applying only the first of Gregory's patches,
> without the second.  WDYT?

I don't think that makes much sense -- the division between the two is =
pretty much artificial.

The third patch can safely be left out in emacs-29.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 10:31:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 06:31:08 2023
Received: from localhost ([127.0.0.1]:42614 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHijz-0005ew-VV
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:31:08 -0400
Received: from heytings.org ([95.142.160.155]:44364)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qHiju-0005ei-PM
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:31:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688725862;
 bh=w+UqkGudODyBIx/jcoEf5zRvbvi4oHgmGu2gpXCV2ec=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=ifePBLA0/8cdQIusCvL4wsRLBKT8Fo2H7YU/6jzsATHNUUD+y+u/gCV8g6yvImvT+
 m90hA0vZ/x7r7yjZ8rB+r1Xr8k+27Rk1S2mq0ArcoCnTwSKxd4uOvyK58GwYuacths
 ELBl2iJbsy1TyhVIBJYYkhFsZL2QhFdiOrJ+9THeIFPvWyoZ6aBzOjQcVHZK5tce6v
 tpF8kddru8UfrtJ9UnMrzd+gDXEg59XtfAXmVX776LXtyxXKLbwW86KIkH1s7cyeLP
 XtXcJ9vNPtx/3XkS9+pJUMpGK930Bl0l04D0HnlFFd3Zu+uGzV41idtqw8eK3LFn9H
 n62D9Lm0zyHRA==
Date: Fri, 07 Jul 2023 10:31:01 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <83v8ewf2b4.fsf@HIDDEN>
Message-ID: <e642cb1e37bae8ddaa9c@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN>
 <26cee506f70bbc9de58b@HIDDEN> <83h6qghpdc.fsf@HIDDEN>
 <26cee506f77e9c87e325@HIDDEN>
 <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
 <e642cb1e375be1f23497@HIDDEN> <83v8ewf2b4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN, bugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>>> I have one question about the new `with-restriction` macro: if it is 
>>> intended as a convenience macro for unlabelled narrowing as well, 
>>> shouldn't it then expand to the obvious
>>>
>>>  (save-restriction
>>>    (narrow-to-region BEG END)
>>>    BODY)
>>>
>>> instead the much more expensive call to a helper function?
>>
>> Yes.  In fact now that we have a separate function for the labeled 
>> case, we can remove the funcall in both cases.  Patch attached.
>
> You are killing me.
>

???  That wasn't meant for the release branch.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 10:28:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 06:28:06 2023
Received: from localhost ([127.0.0.1]:42609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHih4-0005YI-D0
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:28:06 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37354)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qHih1-0005Xi-UM
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:28:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHigw-0004wK-32; Fri, 07 Jul 2023 06:27:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=U0zYGamuHtc013BJoTAPeRxlcKoEX0fUg+smpIiyhVs=; b=Qp7b3DFgVlsjce1AWXTE
 yqLMByDEqira4tuqCi0+SRKWtz6yLJq1HbRrFj5hCjaJW0VcNuIw0zqoPECtyKg0mZHbNqhUXbrw6
 FUXE7XKUWTPduiCSGp5fw/IxoToWnCA68+O35y2OWd/fLjA73WF7kv/VYb7Wit532y3s2jtrq99yG
 DtAaJ0EEI+aqyqFQxj83rIvmv9Cj3BdYJQjar7Ljr0na+qWPH2aNlgYGWLwqivegODJ0K9c28IUFg
 9dJ9Hpv1v6jA0X18HQdSgFoyVn6Uzv4BCKrMErSsoTDN7OXkYoxqiBwUWse1jjk8TA+ixx2isyV5b
 FiuQieqZNaSFsQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHigv-00051o-4R; Fri, 07 Jul 2023 06:27:57 -0400
Date: Fri, 07 Jul 2023 13:27:59 +0300
Message-Id: <83ttugf234.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 7 Jul 2023 11:30:11 +0200)
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN> <26cee506f70bbc9de58b@HIDDEN>
 <83h6qghpdc.fsf@HIDDEN> <26cee506f77e9c87e325@HIDDEN>
 <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, gregory@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattias.engdegard@HIDDEN>
> Date: Fri, 7 Jul 2023 11:30:11 +0200
> Cc: Eli Zaretskii <eliz@HIDDEN>,
>  acohen@HIDDEN,
>  64391 <at> debbugs.gnu.org,
>  monnier@HIDDEN
> 
> Gregory's first two patches and mine are indeed equivalent up to refactoring; either would do. The moving parts are the same, so performance shouldn't differ noticeably. Neither appears to tie our hands for future changes as the interfaces are all internal.

I was considering applying only the first of Gregory's patches,
without the second.  WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 10:23:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 06:23:18 2023
Received: from localhost ([127.0.0.1]:42601 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHicP-0005H2-Nd
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:23:18 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qHicO-0005Gp-69
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:23:17 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHicH-0002qu-LY; Fri, 07 Jul 2023 06:23:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=n45pKPpum6Ww+K4OfBZfI4IWmXag+iTf5Bvk0vtNg7w=; b=DN59+rKuWe/o
 gX11vk7I64ODhX8JXbL0TQe1EwKJA5xxdL61qzBMlk0ny3inVu6JeqdVUuT7U/9O51zbYXS3dO65O
 x9NDrhHAY/aB8TQObMy2e0UePJjhvX0m2vMsj+y2x14jyUZLH1Ln8fwqVWk++SEdwmokGbukd1Y8u
 NKn5U0/VWHreqHRj7G+cCpcbSeBiNngdUhhY25hGj5z4uh1F6374/gnsWeMo+F4d0zI9TBnfYHE7X
 rFM1xubLlxBUfRTNq3ZvIyzkIm0iLr1yZgVahvgpyKH8RTd+HdumMN0RCT5h6PO9INyFdEyc0g8Je
 XF4XbmytstFM4aMZ3ypQmw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHicH-0002J1-59; Fri, 07 Jul 2023 06:23:09 -0400
Date: Fri, 07 Jul 2023 13:23:11 +0300
Message-Id: <83v8ewf2b4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <e642cb1e375be1f23497@HIDDEN> (message from Gregory
 Heytings on Fri, 07 Jul 2023 10:00:48 +0000)
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN>
 <26cee506f70bbc9de58b@HIDDEN> <83h6qghpdc.fsf@HIDDEN>
 <26cee506f77e9c87e325@HIDDEN>
 <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
 <e642cb1e375be1f23497@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN, bugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Fri, 07 Jul 2023 10:00:48 +0000
> From: Gregory Heytings <gregory@HIDDEN>
> cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, 
>     monnier@HIDDEN, bugs@HIDDEN
> 
> > I have one question about the new `with-restriction` macro: if it is 
> > intended as a convenience macro for unlabelled narrowing as well, 
> > shouldn't it then expand to the obvious
> >
> >  (save-restriction
> >    (narrow-to-region BEG END)
> >    BODY)
> >
> > instead the much more expensive call to a helper function?
> 
> Yes.  In fact now that we have a separate function for the labeled case, 
> we can remove the funcall in both cases.  Patch attached.

You are killing me.




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 10:00:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 06:00:56 2023
Received: from localhost ([127.0.0.1]:42576 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHiGm-0004ht-1t
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:00:56 -0400
Received: from heytings.org ([95.142.160.155]:44314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qHiGg-0004hi-Fd
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 06:00:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688724049;
 bh=g7H16IVVxkw3ioxqLLtILU11ZU1fBdS8OsCTyp49RN8=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=WNasf7RzJdPGYKHb5xiBdbm1XHP58Y8EkFFpcHbx4mzkGSR+FPsdcw1M5WASXD6CU
 kBMEePJLfD0j+91Dsvbp8z8OoZOcgV5Lwz2Hy6SICKfud84RKf8+YNEHxSA0Ef21fl
 XFrIy8U7ZS0LziIEW7eESijR5+ofaTMUjmwU0lWGkNOTObySwPxKn7kJ7uCqMC3Yvc
 VzB8ezV2OhRN/K/PFIC5DocFAVnp+yLfDFDLvQw7SlRs7IGoagjyg+iJO2H5DRtciZ
 m6SPY51ya6JOo6vpb4uTmKnDiAwH/3Wk35DD2dsaxUsRxdd3aSRjnMyZF0v+ftFsNY
 u0Z5C1+oWILZA==
Date: Fri, 07 Jul 2023 10:00:48 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
Message-ID: <e642cb1e375be1f23497@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN>
 <26cee506f70bbc9de58b@HIDDEN> <83h6qghpdc.fsf@HIDDEN>
 <26cee506f77e9c87e325@HIDDEN>
 <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="6CfoV80V1X"
Content-ID: <e642cb1e3736aff93fcc@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 monnier@HIDDEN, bugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--6CfoV80V1X
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-ID: <e642cb1e37958d8af4be@HIDDEN>


Thanks for your feedback!

>
> I have one question about the new `with-restriction` macro: if it is 
> intended as a convenience macro for unlabelled narrowing as well, 
> shouldn't it then expand to the obvious
>
>  (save-restriction
>    (narrow-to-region BEG END)
>    BODY)
>
> instead the much more expensive call to a helper function?
>

Yes.  In fact now that we have a separate function for the labeled case, 
we can remove the funcall in both cases.  Patch attached.

>
> The documentation should also make it clear that `nil` is not a valid 
> label.
>

Is that not already clear in the docstring, which says "in which LABEL is 
a symbol"?

--6CfoV80V1X
Content-Type: text/x-diff; name=Simplify-with-restriction-and-without-restriction.patch; charset=us-ascii
Content-Transfer-Encoding: base64
Content-ID: <e642cb1e37ed658a7291@HIDDEN>
Content-Disposition: attachment; filename=Simplify-with-restriction-and-without-restriction.patch

RnJvbSA0ODk3ZDZhZGU4MGU5OTI4YjdmMjVkMGZiNmY5NzBjNDk3NWM0M2Jk
IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogR3JlZ29yeSBIZXl0
aW5ncyA8Z3JlZ29yeUBoZXl0aW5ncy5vcmc+DQpEYXRlOiBGcmksIDcgSnVs
IDIwMjMgMDk6NTQ6MzIgKzAwMDANClN1YmplY3Q6IFtQQVRDSF0gU2ltcGxp
ZnkgJ3dpdGgtcmVzdHJpY3Rpb24nIGFuZCAnd2l0aG91dC1yZXN0cmljdGlv
bicNCg0KKiBsaXNwL3N1YnIuZWwgKHdpdGgtcmVzdHJpY3Rpb24sIHdpdGhv
dXQtcmVzdHJpY3Rpb24pOiBNZXJnZSB0aGUNCmJvZGllcyBvZiB0aGUgJ2lu
dGVybmFsLS13aXRoLXJlc3RyaWN0aW9uJyBhbmQNCidpbnRlcm5hbC0td2l0
aG91dC1yZXN0cmljdGlvbicgZnVuY3Rpb24gaW50byB0aGUgbWFjcm9zLiAg
VGhlDQpyZXN1bHQgaXMgbW9yZSBlZmZpY2llbnQgdGhhbiBhIGZ1bmNhbGwu
DQooaW50ZXJuYWwtLXdpdGgtcmVzdHJpY3Rpb24sIGludGVybmFsLS13aXRo
b3V0LXJlc3RyaWN0aW9uKToNClJlbW92ZS4NCi0tLQ0KIGxpc3Avc3Vici5l
bCB8IDI2ICsrKysrKy0tLS0tLS0tLS0tLS0tLS0tLS0tDQogMSBmaWxlIGNo
YW5nZWQsIDYgaW5zZXJ0aW9ucygrKSwgMjAgZGVsZXRpb25zKC0pDQoNCmRp
ZmYgLS1naXQgYS9saXNwL3N1YnIuZWwgYi9saXNwL3N1YnIuZWwNCmluZGV4
IDg1YWRlZjViNjg5Li40MmE2Y2ZlYzUxNCAxMDA2NDQNCi0tLSBhL2xpc3Av
c3Vici5lbA0KKysrIGIvbGlzcC9zdWJyLmVsDQpAQCAtMzk3MywxNiArMzk3
MywxMCBAQCB3aXRoLXJlc3RyaWN0aW9uDQogXChmbiBTVEFSVCBFTkQgWzps
YWJlbCBMQUJFTF0gQk9EWSkiDQogICAoZGVjbGFyZSAoaW5kZW50IDIpIChk
ZWJ1ZyB0KSkNCiAgIChpZiAoZXEgKGNhciByZXN0KSA6bGFiZWwpDQotICAg
ICAgYChpbnRlcm5hbC0td2l0aC1yZXN0cmljdGlvbiAsc3RhcnQgLGVuZCAo
bGFtYmRhICgpICxAKGNkZHIgcmVzdCkpDQotICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgLChjYWRyIHJlc3QpKQ0KLSAgICBgKGludGVybmFs
LS13aXRoLXJlc3RyaWN0aW9uICxzdGFydCAsZW5kIChsYW1iZGEgKCkgLEBy
ZXN0KSkpKQ0KLQ0KLShkZWZ1biBpbnRlcm5hbC0td2l0aC1yZXN0cmljdGlv
biAoc3RhcnQgZW5kIGJvZHkgJm9wdGlvbmFsIGxhYmVsKQ0KLSAgIkhlbHBl
ciBmdW5jdGlvbiBmb3IgYHdpdGgtcmVzdHJpY3Rpb24nLCB3aGljaCBzZWUu
Ig0KLSAgKHNhdmUtcmVzdHJpY3Rpb24NCi0gICAgKG5hcnJvdy10by1yZWdp
b24gc3RhcnQgZW5kKQ0KLSAgICAoaWYgbGFiZWwgKGludGVybmFsLS1sYWJl
bC1yZXN0cmljdGlvbiBsYWJlbCkpDQotICAgIChmdW5jYWxsIGJvZHkpKSkN
CisgICAgICBgKHNhdmUtcmVzdHJpY3Rpb24NCisgICAgICAgICAoaW50ZXJu
YWwtLWxhYmVsZWQtbmFycm93LXRvLXJlZ2lvbiAsc3RhcnQgLGVuZCAsKGNh
ZHIgcmVzdCkpDQorICAgICAgICAgLEAoY2RkciByZXN0KSkNCisgICAgYChz
YXZlLXJlc3RyaWN0aW9uIChuYXJyb3ctdG8tcmVnaW9uICxzdGFydCAsZW5k
KSAsQHJlc3QpKSkNCiANCiAoZGVmbWFjcm8gd2l0aG91dC1yZXN0cmljdGlv
biAoJnJlc3QgcmVzdCkNCiAgICJFeGVjdXRlIEJPRFkgd2l0aG91dCByZXN0
cmljdGlvbnMuDQpAQCAtMzk5NiwxNiArMzk5MCw4IEBAIHdpdGhvdXQtcmVz
dHJpY3Rpb24NCiBcKGZuIFs6bGFiZWwgTEFCRUxdIEJPRFkpIg0KICAgKGRl
Y2xhcmUgKGluZGVudCAwKSAoZGVidWcgdCkpDQogICAoaWYgKGVxIChjYXIg
cmVzdCkgOmxhYmVsKQ0KLSAgICAgIGAoaW50ZXJuYWwtLXdpdGhvdXQtcmVz
dHJpY3Rpb24gKGxhbWJkYSAoKSAsQChjZGRyIHJlc3QpKQ0KLSAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICwoY2FkciByZXN0KSkNCi0g
ICAgYChpbnRlcm5hbC0td2l0aG91dC1yZXN0cmljdGlvbiAobGFtYmRhICgp
ICxAcmVzdCkpKSkNCi0NCi0oZGVmdW4gaW50ZXJuYWwtLXdpdGhvdXQtcmVz
dHJpY3Rpb24gKGJvZHkgJm9wdGlvbmFsIGxhYmVsKQ0KLSAgIkhlbHBlciBm
dW5jdGlvbiBmb3IgYHdpdGhvdXQtcmVzdHJpY3Rpb24nLCB3aGljaCBzZWUu
Ig0KLSAgKHNhdmUtcmVzdHJpY3Rpb24NCi0gICAgKGlmIGxhYmVsIChpbnRl
cm5hbC0tdW5sYWJlbC1yZXN0cmljdGlvbiBsYWJlbCkpDQotICAgICh3aWRl
bikNCi0gICAgKGZ1bmNhbGwgYm9keSkpKQ0KKyAgICAgIGAoc2F2ZS1yZXN0
cmljdGlvbiAoaW50ZXJuYWwtLWxhYmVsZWQtd2lkZW4gLChjYWRyIHJlc3Qp
KSAsQChjZGRyIHJlc3QpKQ0KKyAgICBgKHNhdmUtcmVzdHJpY3Rpb24gKHdp
ZGVuKSAsQHJlc3QpKSkNCiANCiAoZGVmdW4gZmluZC10YWctZGVmYXVsdC1i
b3VuZHMgKCkNCiAgICJEZXRlcm1pbmUgdGhlIGJvdW5kYXJpZXMgb2YgdGhl
IGRlZmF1bHQgdGFnLCBiYXNlZCBvbiB0ZXh0IGF0IHBvaW50Lg0KLS0gDQoy
LjM5LjINCg0K

--6CfoV80V1X--




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 7 Jul 2023 09:30:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 05:30:31 2023
Received: from localhost ([127.0.0.1]:42530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHhnK-0003rL-Mf
	for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 05:30:31 -0400
Received: from mail-lj1-f173.google.com ([209.85.208.173]:44406)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1qHhn9-0003qv-D2
 for 64391 <at> debbugs.gnu.org; Fri, 07 Jul 2023 05:30:29 -0400
Received: by mail-lj1-f173.google.com with SMTP id
 38308e7fff4ca-2b703caf344so24419111fa.1
 for <64391 <at> debbugs.gnu.org>; Fri, 07 Jul 2023 02:30:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1688722213; x=1691314213;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject
 :date:message-id:reply-to;
 bh=5Y8jdh4DgbARQAMcKPM21wGWhUrNnK9GLrr5Au9nWx8=;
 b=iYXeY3uHsZ6vJgv7MMvlhGiR1eqQjbPuVMPqCmgf+S23GSfhnoeXP4/yoMqCy86UO1
 sH5/GsDHcW3N2B9PUItig2aBr26MDMgl+ydFB+cHwOAEJaFOP471U0rBo5Befkf19QMB
 D4oxhpYFeGRePoHVkBIFyn/u/Ax1CxcF5cs+BkLenbx2xRaEzI/J+FyvjqEDR1qXo+cs
 3BDAEP33rCkU/gWhyV2cEidNJBW6wwhlPIjcvOI0oBuZTA2MokovQWau9IP7dAIFZk2R
 OE9V58PAsi1/1Hc7IxLcZtZIOy0ZneW6v+CI7TuetfvflDJIzyJIh4xz34RiO/EW9trM
 f7Sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1688722213; x=1691314213;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=5Y8jdh4DgbARQAMcKPM21wGWhUrNnK9GLrr5Au9nWx8=;
 b=g+sN001j1X7JGv0ky9HdrBbxrASErjaaTkRc0TjbRnlWUvju3MyaWfPuewRe0ZN+/X
 xtRJLc1t6awcQBYXUOnofkj/FHoRj3cZIlP85/nKYovQX9D0S8bdZoUzC5wSYpZ7/7Jd
 u41i09pKcJeo5f1qIMfrWtcwgCry/KdLtFCY6WzVwU00LH+hrwF9QTxPmvfrKCT8By6Y
 IaWhKOt9CzjxdWwZPiiayRhlBsEWdV7Z05beb7KxFNZArqFrLrswHSQRnUZtqcTqTJiR
 67v+99jRqNq562ZAgGrdEDEFMPmDzlsG+7DMEYMgj+qAw5yqJ/SV0Xj0R4CV6lKnd5HY
 VjOA==
X-Gm-Message-State: ABy/qLYgH4/p8UAKy34/dLcX8W3/21RScZJwZBhqrBr9Ixre4gbHevzG
 O2zM7cLMVfNmbGDQHRKNxbE=
X-Google-Smtp-Source: APBJJlErkJzSBBK37bDVp129YzJ2aUJVmbB4TZAUQKSqlegsStRmRL87YNTXaL/Cej31t+YJRm+SUQ==
X-Received: by 2002:a2e:9d04:0:b0:2b6:e8a0:a7f8 with SMTP id
 t4-20020a2e9d04000000b002b6e8a0a7f8mr3135242lji.31.1688722212987; 
 Fri, 07 Jul 2023 02:30:12 -0700 (PDT)
Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se.
 [188.150.165.235]) by smtp.gmail.com with ESMTPSA id
 s21-20020a2e83d5000000b002b6d5395732sm691833ljh.1.2023.07.07.02.30.12
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 07 Jul 2023 02:30:12 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29 
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <26cee506f77e9c87e325@HIDDEN>
Date: Fri, 7 Jul 2023 11:30:11 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <F61D0758-868C-46E3-B305-CD93A9CE5B43@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN> <26cee506f70bbc9de58b@HIDDEN>
 <83h6qghpdc.fsf@HIDDEN> <26cee506f77e9c87e325@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

6 juli 2023 kl. 20.45 skrev Gregory Heytings <gregory@HIDDEN>:

>> How are those different from what Mattias proposed?  Is this a =
completely different set of changes, or is it what Mattias suggested, =
just in several separate parts?
>>=20
>=20
> It resembles what Mattias proposed of course (remove the negative =
effect of setting a buffer-local variable in all calls to =
narrow-to-region, and limit it to case when labeled narrowing is used), =
but it's nonetheless different.  The essential change is isolated in the =
first commit, and in the second commit, instead of moving the body of =
Fnarrow_to_region to another function with an additional (third) =
argument, I use another separate function which calls Fnarrow_to_region. =
 I believe the result is clearer.

Gregory's first two patches and mine are indeed equivalent up to =
refactoring; either would do. The moving parts are the same, so =
performance shouldn't differ noticeably. Neither appears to tie our =
hands for future changes as the interfaces are all internal.

The third of Gregory's patches appears mainly cosmetic. Maybe that one =
is less important for emacs-29.

I have one question about the new `with-restriction` macro: if it is =
intended as a convenience macro for unlabelled narrowing as well, =
shouldn't it then expand to the obvious

  (save-restriction
    (narrow-to-region BEG END)
    BODY)

instead the much more expensive call to a helper function?

The documentation should also make it clear that `nil` is not a valid =
label.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 6 Jul 2023 18:45:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 06 14:45:54 2023
Received: from localhost ([127.0.0.1]:42049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHTzG-0005wn-Ec
	for submit <at> debbugs.gnu.org; Thu, 06 Jul 2023 14:45:54 -0400
Received: from heytings.org ([95.142.160.155]:43534)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qHTzD-0005wb-G4
 for 64391 <at> debbugs.gnu.org; Thu, 06 Jul 2023 14:45:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688669150;
 bh=CL85AMBzABsOdhIrt46AqhJIG1bu4ubQnLldK/EzHNg=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=GG7vmhJcS7g0HYbSqyjbSKnAdO43wH5QWTkEieXFDcgLbPgu5ti9fsEVBgztABgXm
 RuiC0Zg41tQZgB8Axzao65SK9kf3P5gN8UnOLJtuNDkiTALvlt8Jd8GvX4IZgB4kqz
 EkT+EzX9UWUuK0E+jB8GDO4808h9lcnEPTj8oGEE8JBsKqQOeH+f3sDzebFmC8yOOy
 pN1SbvwqJqZwC8MUxvf71W7VCo2vgv1cmF4aC9b1Vp2eumU1k1yCDly1mJxgRmSJhr
 NlXJDJlF+erEHRE/0/aRxQsy0JXqRTEtNHz+fJLzl637/7VnKd+FfsHXc7uGldSC63
 z1EuYmQjQ9DqA==
Date: Thu, 06 Jul 2023 18:45:50 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <83h6qghpdc.fsf@HIDDEN>
Message-ID: <26cee506f77e9c87e325@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN>
 <26cee506f70bbc9de58b@HIDDEN> <83h6qghpdc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>> I pushed a proposed change to the scratch/bug64391 branch.
>>
>> It contains three commits:
>>
>> - b741dc7fcd which is the minimal possible commit to fix this bug
>>
>> - 01fb898420 which moves a few statements from the callee 
>> (internal--label-restriction) to its only caller 
>> (internal--labeled-narrow-to-region), and simplifies the code 
>> accordingly
>>
>> - c52ade305e which is optional, and makes the symmetrical change for 
>> the widening case
>>
>> Eli and Mattias, could you perhaps have a look?
>
> How are those different from what Mattias proposed?  Is this a 
> completely different set of changes, or is it what Mattias suggested, 
> just in several separate parts?
>

It resembles what Mattias proposed of course (remove the negative effect 
of setting a buffer-local variable in all calls to narrow-to-region, and 
limit it to case when labeled narrowing is used), but it's nonetheless 
different.  The essential change is isolated in the first commit, and in 
the second commit, instead of moving the body of Fnarrow_to_region to 
another function with an additional (third) argument, I use another 
separate function which calls Fnarrow_to_region.  I believe the result is 
clearer.

>
> If these are different, did you time the results in the use case(s) 
> where the slow-down was detected and reported, and compared the two 
> proposals performance-wise?
>

Yes, there is no difference, performance-wise:

- with Mattias' patch:

Modify after narrowing:  0.114 s elapsed, 0 GCs, 0.000 s GC, 0.114 s non-GC
Modify before narrowing: 0.103 s elapsed, 0 GCs, 0.000 s GC, 0.103 s non-GC

- with the code in scratch/bug64391:

Modify after narrowing:  0.109 s elapsed, 0 GCs, 0.000 s GC, 0.109 s non-GC
Modify before narrowing: 0.102 s elapsed, 0 GCs, 0.000 s GC, 0.102 s non-GC

(The small differences are not meaningful, other runs show different 
values in the same order of magnitude.)





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 6 Jul 2023 18:22:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 06 14:22:15 2023
Received: from localhost ([127.0.0.1]:42024 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHTcN-0005La-18
	for submit <at> debbugs.gnu.org; Thu, 06 Jul 2023 14:22:15 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49148)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qHTcK-0005LM-OI
 for 64391 <at> debbugs.gnu.org; Thu, 06 Jul 2023 14:22:13 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHTcE-0005s7-RW; Thu, 06 Jul 2023 14:22:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=jh3PZr3rFyeka8knz/g0SYN+11+6TQKHPYK43MKKNFE=; b=cTc+ibvH2mOC
 1d7de9H28KWlOgpyCycbKaW4iNmn0qa01Um18sJ+17TbRutZZMufve3XdLs52Mf2c0ZX0VR4iROWm
 G9qC4YM/5AD/13iYbm8Z4WVkB41pFk15lejEXUghpNz65MRaLnU02rI02Cf58pDYFyeNr+cO8ElHq
 OjWBBtYGuYmuhTf3gDGM6Rlk/0uQbFLV4aAynBivUdBmunQldJrwg7lx3rCdeJY5Zqu3VwlkxK1Ly
 +nxiZe0h6WCeVsQ8qGA15CMgNLLNU2TTbf/DcWItbvgn4Otumar67fFngdMmyeqPxOSGb72AIV0XD
 Ld0/ymjxaKILb4YWskB4rg==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qHTcE-0008CT-An; Thu, 06 Jul 2023 14:22:06 -0400
Date: Thu, 06 Jul 2023 21:22:07 +0300
Message-Id: <83h6qghpdc.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <26cee506f70bbc9de58b@HIDDEN> (message from Gregory
 Heytings on Thu, 06 Jul 2023 17:33:13 +0000)
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN> <26cee506f70bbc9de58b@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 06 Jul 2023 17:33:13 +0000
> From: Gregory Heytings <gregory@HIDDEN>
> cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN, 
>     monnier@HIDDEN
> 
> 
> I pushed a proposed change to the scratch/bug64391 branch.
> 
> It contains three commits:
> 
> - b741dc7fcd which is the minimal possible commit to fix this bug
> 
> - 01fb898420 which moves a few statements from the callee 
> (internal--label-restriction) to its only caller 
> (internal--labeled-narrow-to-region), and simplifies the code accordingly
> 
> - c52ade305e which is optional, and makes the symmetrical change for the 
> widening case
> 
> Eli and Mattias, could you perhaps have a look?

How are those different from what Mattias proposed?  Is this a
completely different set of changes, or is it what Mattias suggested,
just in several separate parts?

If these are different, did you time the results in the use case(s)
where the slow-down was detected and reported, and compared the two
proposals performance-wise?




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 6 Jul 2023 17:33:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 06 13:33:20 2023
Received: from localhost ([127.0.0.1]:41970 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHSr1-0003tP-Rv
	for submit <at> debbugs.gnu.org; Thu, 06 Jul 2023 13:33:20 -0400
Received: from heytings.org ([95.142.160.155]:43452)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qHSqw-0003tE-SU
 for 64391 <at> debbugs.gnu.org; Thu, 06 Jul 2023 13:33:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688664793;
 bh=6M4k1pZqXdmV8O5Aj1ric1LAi2zt8LMCC/dnL+aw8h4=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=DJ4GB6uDnMxTIXMEG5ruSMuPD+AOu0lcEc8PNeb2jDCZZFTz04iJskO+JRwbbQxrb
 uVQDoTa7vn8Ipyw9f067SsUjRPrUdr+4YOBtGBHNMS0GaOJexlFb8QeVgvEDhCTXRv
 xCGIB6k7mUqivleWV1iWT8yV/ifSK1r6HROIDkCVJ7sAw9CBb9zjKbtU0Eiu01kCy3
 jxASSqvKgnxwFaTnrq9l/Kn/R8CDNew7angP5u4Phjb5UbDJlOgWTr7wAPougq/R3I
 jDnwh7XqHvZ3nIs187CIgT60gcFaBD8VhAPnezLVOFkpK4qN5Ap8FaCZIBkfthPuIw
 g+htMPAMDi4OQ==
Date: Thu, 06 Jul 2023 17:33:13 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <26cee506f708f3c6cfe1@HIDDEN>
Message-ID: <26cee506f70bbc9de58b@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
 <26cee506f708f3c6cfe1@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


I pushed a proposed change to the scratch/bug64391 branch.

It contains three commits:

- b741dc7fcd which is the minimal possible commit to fix this bug

- 01fb898420 which moves a few statements from the callee 
(internal--label-restriction) to its only caller 
(internal--labeled-narrow-to-region), and simplifies the code accordingly

- c52ade305e which is optional, and makes the symmetrical change for the 
widening case

Eli and Mattias, could you perhaps have a look?

Thanks.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 6 Jul 2023 14:41:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 06 10:41:21 2023
Received: from localhost ([127.0.0.1]:41794 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qHQAb-0002BV-Fh
	for submit <at> debbugs.gnu.org; Thu, 06 Jul 2023 10:41:21 -0400
Received: from heytings.org ([95.142.160.155]:43246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qHQAV-0002BI-UM
 for 64391 <at> debbugs.gnu.org; Thu, 06 Jul 2023 10:41:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688654474;
 bh=Q8iQVCDBuFRjI2IfsHNCpLJPvi2yIbu5ew0sR2PL820=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=xpwOnkgaprWd4zrd26nhmcS1uutiyShedQS2bBntS3QtdjKVk0oVRjMpnt2waIUE9
 T5xE5+16cLzP0Njz9c5o+0pWZGh7wuweidmJeCuP0zcujRoUBTPoMAP7UJ6SwyjhkC
 6wPqo0M6qFcvZOR3aKPlaOmDJwb6pDvIkEx7YnGW8Rdpv5baHRgyQlMhEI8XeOZ1FW
 2SzFxpOHcSA7v5nI3gssD1IrX3m9DwUs+jBJuzG3wx2p5JzK+qle56sUbUIbu0/YnZ
 I4BCTzYFdDaaO1T9Con0Dmj/qmwSSJwaMaH6XH3Gk63okhxCyYnjEUNvKRxiEz8aJR
 YYJ7L266n1YLw==
Date: Thu, 06 Jul 2023 14:41:13 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <83a5wak1tr.fsf@HIDDEN>
Message-ID: <26cee506f708f3c6cfe1@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN> <83a5wak1tr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN, bugs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>> Thanks Andrew for the bug report, and Mattias for the patch.
>>
>> I'll have a look in a few hours.
>
> Any progress there?
>

Sorry for the delay, I'm looking at this right now.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 5 Jul 2023 11:58:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 05 07:58:06 2023
Received: from localhost ([127.0.0.1]:37818 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qH194-0003w9-9T
	for submit <at> debbugs.gnu.org; Wed, 05 Jul 2023 07:58:06 -0400
Received: from eggs.gnu.org ([209.51.188.92]:46056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qH191-0003vc-Bn
 for 64391 <at> debbugs.gnu.org; Wed, 05 Jul 2023 07:58:05 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qH18t-0000Yp-Ji; Wed, 05 Jul 2023 07:57:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Ls/bcAIdFmzNxSmotJ9WHeZk53yKncgVLSRT2zwO6/A=; b=WBursBU1Sl0x
 Twka3y+tlAXScG5MmfDJTxjlAUx9SWiZFDbea1aXIGdbOInkC+GlVcev3jSqTDZb2DpAblpVGXLvf
 dDG61PFKMmZCqetw1wYF/uHBYNZ8Lo1GINVbyJOHQYPpqPU3MIbRxhZMaWcS1NdzUMOJo5NhvBeo4
 f9izXHqwZLOoH+D5aZ1BMXVAwAqhlg9qVMFfQOds2WmEzvJv/hYTVwMY07abwYl1XSyHoCH2YGn1U
 5Gmyad5zUVR39ZEKA5BQI45AsZUm2BuMrMbWHb1p7l0CYEYcOOU4bnvSqNUeEnVZy3SGYXB+psEED
 IwvDzpJv5iHA1vi0hopdSQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qH18s-0002Oc-DO; Wed, 05 Jul 2023 07:57:55 -0400
Date: Wed, 05 Jul 2023 14:57:52 +0300
Message-Id: <83a5wak1tr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <5995c9ed6a0b39c3070c@HIDDEN> (message from Gregory
 Heytings on Sun, 02 Jul 2023 07:35:13 +0000)
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
 <5995c9ed6a0b39c3070c@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, mattias.engdegard@HIDDEN,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 02 Jul 2023 07:35:13 +0000
> From: Gregory Heytings <gregory@HIDDEN>
> cc: Eli Zaretskii <eliz@HIDDEN>, 64391 <at> debbugs.gnu.org, 
>     Stefan Monnier <monnier@HIDDEN>
> 
> 
> Thanks Andrew for the bug report, and Mattias for the patch.
> 
> I'll have a look in a few hours.

Any progress there?




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 2 Jul 2023 09:38:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 02 05:38:06 2023
Received: from localhost ([127.0.0.1]:59327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFtWw-00035h-Bh
	for submit <at> debbugs.gnu.org; Sun, 02 Jul 2023 05:38:06 -0400
Received: from mail-lj1-f180.google.com ([209.85.208.180]:50650)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1qFtWr-000357-1I
 for 64391 <at> debbugs.gnu.org; Sun, 02 Jul 2023 05:38:05 -0400
Received: by mail-lj1-f180.google.com with SMTP id
 38308e7fff4ca-2b5e7dba43cso54509561fa.1
 for <64391 <at> debbugs.gnu.org>; Sun, 02 Jul 2023 02:38:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1688290675; x=1690882675;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:from:to:cc:subject:date:message-id:reply-to;
 bh=GTQ6lRsWDG2ycsSf9hQOeCIzB+XY6DrOl2Zc3uE53fE=;
 b=ExTtvjFekEmWJO7PUXtUpDW03BStvrSF8uqfSs8lZymbitnHGZCRbmI/PHAQNN073D
 u4aLYvuHgnFWi9f7rLvQhmTlRm1OjtAovpQrNVSCPNQGIFGxK3emwvF8AR3GlcRJVfOu
 OaEcC6FhGOt9t/Oh26TJEEfIMPtEzfF2G0GwEjuWLaiXqTgMO4LzkPR1VcEXlJILFS4m
 YA2p3PU16Ks/zt8+oxdSQYsh7zJr2jLKAdWvnxoRQ2EATooO8AlFddnj4U8ODyKwYqkh
 p++rzLJ+qlPqQUhoCN9CCI9LiCVJkug2qJIOHglYCVUMfZ6FkHEtYl6t32P8ho4ue7n4
 eL7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1688290675; x=1690882675;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=GTQ6lRsWDG2ycsSf9hQOeCIzB+XY6DrOl2Zc3uE53fE=;
 b=DOtym9KQwMn50TfNunXByIgAeZh7H4OJ+EZ6mh6diG2HqIT2SgQccT81JqeRXF8uTH
 BbbIYYsHPQTtfc+lEzs5OWuyuHquG0yCY4+kVzcyytqVeh/MFSTWAf7oSJWO9WgAIKCg
 jW5wxelTREZc3Oliqmsz4qErsseL9xLbnopMdWH2LAejauIJKVSp8/23y3mWPFHLUZLU
 +FDa5sipjT+KfvAeg4r2wa3Oomidf0p9LS1T5I9/AE+jpzKSU2MeuyTGzfauvtdthheq
 7pIvdsbTbftRdSLO7OBLI+JCGfF/ywaNwkSdYykR9EgafuFbKITLppHERSTRognCidZQ
 jamg==
X-Gm-Message-State: ABy/qLberDi9eqsSzcf1bePyfcC2muvXF6gnqnaesQyJYMJHxzzB9QGy
 G0j46OdLqGt6wwT6i9xYbvM=
X-Google-Smtp-Source: APBJJlG7M9vUmb8Wxp0IglVy7KHRN0tQ4KgtAeL0xMZT/WtpBDxObYc6ca131diPQKEqWQScXlwjYw==
X-Received: by 2002:a05:6512:3a8e:b0:4fb:8a90:396c with SMTP id
 q14-20020a0565123a8e00b004fb8a90396cmr5741806lfu.38.1688290674529; 
 Sun, 02 Jul 2023 02:37:54 -0700 (PDT)
Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se.
 [188.150.165.235]) by smtp.gmail.com with ESMTPSA id
 b8-20020ac25628000000b004fa5bfddabesm3698563lff.296.2023.07.02.02.37.54
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 02 Jul 2023 02:37:54 -0700 (PDT)
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Message-Id: <C483C339-7ACB-4B39-9777-1D70A67BCB2C@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_D60DCAFD-2DC7-4E30-AC14-9B372DA18783"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29 
Date: Sun, 2 Jul 2023 11:37:53 +0200
In-Reply-To: <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: Andrew Cohen <acohen@HIDDEN>, 64391 <at> debbugs.gnu.org,
 Gregory Heytings <gregory@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--Apple-Mail=_D60DCAFD-2DC7-4E30-AC14-9B372DA18783
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

How expensive markers can be when a buffer is modified is often =
unappreciated. Here are the results of a benchmark to illustrate the =
cost (code attached).
A buffer contains "abababab...", we optionally add a marker to every =
other position, and then time the deletion of all the "a"s. Results:

|   size | without markers | with markers |
|--------+-----------------+--------------|
|    500 |           0.000 |        0.001 |
|   1000 |           0.001 |        0.004 |
|   5000 |           0.002 |        0.089 |
|  10000 |           0.005 |        0.363 |
|  50000 |           0.024 |        9.527 |
| 100000 |           0.049 |       58.048 |

Now there's something for the curve-fitters among you.


--Apple-Mail=_D60DCAFD-2DC7-4E30-AC14-9B372DA18783
Content-Disposition: attachment;
	filename=abench4.el
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="abench4.el"
Content-Transfer-Encoding: 7bit

;;; -*- lexical-binding: t -*-

(require 'cl-lib)

(defun abench-run ()
  (let ((buffer-undo-list t))
    (goto-char (point-min))
    (while (not (eobp))
      (delete-char 1)
      (forward-char))))

(defun abench (size use-markers)
  (with-temp-buffer
    ;; Populate buffer
    (insert (mapconcat #'identity (make-list size "ab") nil))
    ;; Insert markers
    (let ((markers nil))
      (when use-markers
        (dotimes (i size)
          (push (set-marker (make-marker) (* i 2)) markers)))
      ;; Run operation
      (garbage-collect)
      (let ((gcs0 gcs-done)
            (gc-e0 gc-elapsed)
            (t0 (float-time)))
        (abench-run)
        (let ((dt (- (float-time) t0))
              (gcs (- gcs-done gcs0))
              (gc-time (- gc-elapsed gc-e0)))
          (cl-assert
           (equal (buffer-string)
                  (mapconcat #'identity (make-list size "b") nil)))
          (list dt gcs gc-time))))))

(defun abench-main ()
  (princ (format "Emacs %s\n" emacs-version))
  (princ (format "| size | without markers | with markers |\n"))
  (princ (format "|------+-----------------+--------------|\n"))
  (dolist (size '(500 1000 5000 10000 50000 100000))
    (let ((res-without (abench size nil))
          (res-with (abench size t)))
        (princ (format "| %d | %.3f | %.3f |\n"
                       size
                       (nth 0 res-without)
                       (nth 0 res-with)))))
  (princ (format "|------+-----------------+--------------|\n"))
  )

(abench-main)


--Apple-Mail=_D60DCAFD-2DC7-4E30-AC14-9B372DA18783--




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 2 Jul 2023 07:35:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 02 03:35:17 2023
Received: from localhost ([127.0.0.1]:59142 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFrc5-0008K4-EK
	for submit <at> debbugs.gnu.org; Sun, 02 Jul 2023 03:35:17 -0400
Received: from heytings.org ([95.142.160.155]:37830)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1qFrc3-0008Jv-2V
 for 64391 <at> debbugs.gnu.org; Sun, 02 Jul 2023 03:35:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1688283313;
 bh=o6z+xlIRGkhNuYBT9yjA/Q+YYUnBGHVQRR/iqYPbsXw=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=TdWcevic9k3Pn/VEH936QCALocQ2NgoIeiJdzOr4hrSraNipW4QO64YowBnEAHVpH
 ei5S23uwxsQkd2md+SwFzuXVtptzYUg4aVIQy/ANQpc4HpA3mWBT0lilKmUd8prAbM
 F7dQYuVxEnRQme7/Q3PaEB1+iyqhd8rROMRH7xl1SZ9qcBaMRulr/B1OW4qOOyKW40
 yWKH4wk3gx5UXwwDgfUU8phicobe2ty4F2tub9o4VpZiO2nFWRJjgfN4M4+IIljKfs
 D+znc13ri3fmCbjw307P9NOl1xae6EIdL9d6+ix9yQSQEc2F3x3ljblQwDI5Q6Gq4p
 QV6rzsLgVAOCw==
Date: Sun, 02 Jul 2023 07:35:13 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>, 
 =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
In-Reply-To: <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
Message-ID: <5995c9ed6a0b39c3070c@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
 <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: 64391 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Thanks Andrew for the bug report, and Mattias for the patch.

I'll have a look in a few hours.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 12:53:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 08:53:11 2023
Received: from localhost ([127.0.0.1]:56959 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFa6A-00017U-Uc
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 08:53:11 -0400
Received: from mail-lj1-f174.google.com ([209.85.208.174]:51683)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1qFa66-00016x-A8
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 08:53:09 -0400
Received: by mail-lj1-f174.google.com with SMTP id
 38308e7fff4ca-2b69ea3b29fso46031391fa.3
 for <64391 <at> debbugs.gnu.org>; Sat, 01 Jul 2023 05:53:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1688215980; x=1690807980;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ORKH1uu0k2R315ZRVlmHE5Ubllg9dzDa3fKq+klm/X8=;
 b=aM/cWFbIZSyeumAz0sd6em4pBi6m/cFMyCqtE7XbSQSkNZUql0EcbyLycztia5jKa5
 fCNnvH/NLH+WEhP/gFGllKqow5HoaqOUFhy88Dut0eBEw+dku74N+bFajRvyQRv0P6xs
 6YEObIVYz3qJeBdTr5QVbYVIqZ96h03OlC/NzO9N/isvfT/RGPdIw7j2QrsZrfVc06Zi
 L8TFZH30kNi+y2FWAfmgUW9qTzV0ZQqB85h0J0ZaEARwOtHN9QCOmZVd/tppk1OEQxwt
 okUH5iyt1idwAjDYy+rVM3lXaMiCy2G9kDT08XHH0T0WeN0X1nZYAWyHSL5zFI3byxPH
 h+DA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1688215980; x=1690807980;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:sender:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ORKH1uu0k2R315ZRVlmHE5Ubllg9dzDa3fKq+klm/X8=;
 b=UlzbF85TxHMVUDCduJ69gFFPEFJGovuEMVuepIi7b7DQWHmRmMxzyEbwjcLabw5a+J
 9ENfONtk3V5yzXetZm06bKl1tPCrvsqYwAkoG7v/7xjgFZGtI4duW2jVxDfhYavrbsBr
 zpbXtElXq+79Ygfkt2rG8QrfJGqA9wO4QdVpTkSKf+Rt9JCZVtBrJwHv+CuGsshQhwae
 mo+IM6c+eWDvUr0IuK1V0W4GIe3UWPqyzF/ferA0hQDLZSzpR+8p3YxA+jYnD7WkCZE5
 pFDpyEs6sA37AtzHGvwowWq0opkt9y2CuuMCsq5HEZwwC/cJjdpz5i6QqJehbZnpiYV2
 Rsxg==
X-Gm-Message-State: ABy/qLbsgklXJC0UTQlsoY6251WS1xKCeuHHZmv1UF9Hc79xFn6ujdru
 Kf72mxLBOqk2NPbG11jgo8w=
X-Google-Smtp-Source: APBJJlHlhh0aY0FVHyU/I36Vl1zSoR5CMOZVaXm7Y3Dm1W+00Z1sqDF70NsunreNDmqtszo6os/bdw==
X-Received: by 2002:a2e:868b:0:b0:2b6:d0af:effd with SMTP id
 l11-20020a2e868b000000b002b6d0afeffdmr3274164lji.4.1688215979812; 
 Sat, 01 Jul 2023 05:52:59 -0700 (PDT)
Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se.
 [188.150.165.235]) by smtp.gmail.com with ESMTPSA id
 a16-20020a2e88d0000000b002b6a6f958a0sm2771632ljk.7.2023.07.01.05.52.59
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 01 Jul 2023 05:52:59 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <83v8f3q1ff.fsf@HIDDEN>
Date: Sat, 1 Jul 2023 14:52:58 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> <83v8f3q1ff.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: Andrew Cohen <acohen@HIDDEN>, 64391 <at> debbugs.gnu.org,
 Gregory Heytings <gregory@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

1 juli 2023 kl. 14.08 skrev Eli Zaretskii <eliz@HIDDEN>:

>> The attached patch combines narrow-to-region and =
internal--label-restriction into a single function, =
internal--narrow-to-region. (We could also add the label as an optional =
argument to narrow-to-region.)
>=20
> It does more than that, so I'd appreciate a more detailed description
> of the changes and their rationale.

Actually that's just what it does. Here is a tentative commit message:

    Fix severe narrowing performance bug (regression from emacs 28)
   =20
    In Emacs 29, `narrow-to-region` conses and creates markers
    unconditionally on the offchance that a call to
    `internal--label-restriction` would need it, which is only rarely =
the
    case (in `with-restriction` with a :label argument).
   =20
    As a remedy we fuse the two functions to one,
    `internal--narrow-to-region`, and only perform the costly consing =
and
    marker creation for labelled narrowing. (Bug#64391)
   =20
    * lisp/subr.el (internal--with-restriction):
    * src/editfns.c (labeled_narrow_to_region):
    Call `internal--narrow-to-region` instead of `narrow-to-region`
    followed by `internal--label-restriction`.
    (Fwiden): Remove assignment to eliminated `outermost-restriction`.
    (Fnarrow_to_region): Reduce to a stub that calls the original
    function, now named...
    (Finternal__narrow_to_region): ...this, which takes an added
    `label` argument and includes at the end the optimised body of...
    (Finternal__label_restriction): ...this function, now removed
    since it has been entirely absorbed.
    (syms_of_editfns): Remove the `outermost-restriction` buffer-local
    variable as it was only used to convey data from `narrow-to-region`
    to `internal--label-restriction` called immediately afterwards.

And again, if anyone would prefer an optional `label` argument to =
`narrow-to-region` then that would be fine too. It depends a little on =
whether we want to expose that functionality to the user in that =
function, or as now keep it in `with-restriction` only.





Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 12:08:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 08:08:17 2023
Received: from localhost ([127.0.0.1]:56910 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFZOj-0008FY-CO
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 08:08:17 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36158)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qFZOf-0008FJ-0f
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 08:08:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFZOY-0005BT-Eq; Sat, 01 Jul 2023 08:08:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=8RYxNzhHLozd1Vy26j6TW3QaFxSmtDekXTvOGhzjvs4=; b=kvrtYLEm1MPEOw8uwJWR
 2UaGK+BOpcNNOwQyP+9hZNvBmVjcdgXkQqWS2OxJfeprxPk8JKomc8Y8lBhNZbjIwaP1EoU5AuUEA
 pRiuop6/2oA+bd3fh49aPhj1cBxgbUPkiMqodKW7VG52S9M12fEWf9YS1C5NTAyWqM+cgcAv3Bp0D
 GO97Uvpl3kT44FbahrsAacX5zwdZx4J2w2M7UGaNWxaB/zUN13BN6G/QlR5qfU6OawkkC95f7H2aX
 VEphKZT+Lu1PQxiIEF3Zdwd6QWmWWE/fuzzImbvzPI3TN3HQSM5xAOB0UkU0FQZ+XScP8gTAIe0ld
 nAhxTzVJZ4c6OQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFZOX-0005wM-Uf; Sat, 01 Jul 2023 08:08:06 -0400
Date: Sat, 01 Jul 2023 15:08:36 +0300
Message-Id: <83v8f3q1ff.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
In-Reply-To: <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 1 Jul 2023 13:37:08 +0200)
Subject: Re: bug#64391: buffer narrowing slowdown regression in emacs 29
References: <87r0psb51z.fsf@HIDDEN>
 <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: acohen@HIDDEN, 64391 <at> debbugs.gnu.org, gregory@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattias.engdegard@HIDDEN>
> Date: Sat, 1 Jul 2023 13:37:08 +0200
> Cc: 64391 <at> debbugs.gnu.org,
>  Gregory Heytings <gregory@HIDDEN>,
>  Eli Zaretskii <eliz@HIDDEN>
> 
> 1 juli 2023 kl. 06.59 skrev Andrew Cohen <acohen@HIDDEN>:
> 
> > Just for fun I simply commented it out (since the test code doesn't use
> > labeled restrictions) and ran the test code, and the problem disappears:
> 
> The attached patch combines narrow-to-region and internal--label-restriction into a single function, internal--narrow-to-region. (We could also add the label as an optional argument to narrow-to-region.)

It does more than that, so I'd appreciate a more detailed description
of the changes and their rationale.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 11:37:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 07:37:19 2023
Received: from localhost ([127.0.0.1]:56836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFYuk-0007Ng-P0
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 07:37:18 -0400
Received: from mail-lf1-f45.google.com ([209.85.167.45]:54750)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattias.engdegard@HIDDEN>) id 1qFYuh-0007NQ-Us
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 07:37:17 -0400
Received: by mail-lf1-f45.google.com with SMTP id
 2adb3069b0e04-4f875b267d9so4564758e87.1
 for <64391 <at> debbugs.gnu.org>; Sat, 01 Jul 2023 04:37:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1688211430; x=1690803430;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:from:to:cc:subject:date:message-id:reply-to;
 bh=r8CFC5EefuTRyV7RmwIOFSHJ8WrZ78TQGG+LrZ0BhB0=;
 b=LDNHjiOdewuoZPJWQuiWbFXB7MBr3dabZzu4YR8GBme1fzJWuwQMwk0Hn4clMuexDf
 HiTDnuhwU1JDNP8BRqFFCYSwv03OsuKba7HjoOHX5sa1HWrSjmT9wRmNnNyNk6Xedb6X
 Td8+I1xxw8kVQK9RJhtiJPnfQ9ByF8fkKT+4YQ8a920RflIx/XQQCAwxS6l8qW/goDQ2
 FGDnoMyTqRnQF7IVUohHJJ6vzUxAAso1934W7xt0CscLjSohxDvJgLLfzAZTO/RikGkF
 havMvtvphsq4myfpC7RwHojU5qJS4y/DmvE5SMIgENbF+NAlzJjcpybzTGKjBJczNIRz
 65RA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1688211430; x=1690803430;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=r8CFC5EefuTRyV7RmwIOFSHJ8WrZ78TQGG+LrZ0BhB0=;
 b=llQZtLv4CJJfUe8koGs6Nji9UPWi+LOqbCUsSQeJIkh5kXWKq/ja9xNLVP/6wUvrsG
 J8RzqH8Roh8bzUNJS7zdC+VsZdG8vFU7xcuPaN0RaiUTyBkDmy+h4dLxWjEcIfCyroTF
 Y92YvbzxTcrcMx33lZ2tr7P0oZFctGDERhYYedT/WjF/D7ezMKpPj8rSP4oWiYggJpDt
 uwskUa6nzTAsgWUeJd6qamK6SDxmcOCV4QOZUQXJmVvjbCq/uOO48ZfbbzSEKTr9SCuo
 ThMwvNNzxQEcjnx3ooE1T+cHTqfjdtGQBZbMLsQxLcN+8FUe1PMA2jdwed1mSsiW7BlZ
 Ej4g==
X-Gm-Message-State: ABy/qLY7uR93OM1Lg0Xkfnl6im6wWiQcEgnAOebc+8VRyIfKRqV0WUmk
 ZgwiRbmqGN8/+oahaZfqWvuoMzxkuEg=
X-Google-Smtp-Source: APBJJlFm1q6YoWutrG9TZdXnxYtY3e2+FNRiLJm9StEMApGF4QIgeCLWpi9YbZkZWJZeDu89dYOsxA==
X-Received: by 2002:a05:6512:3b0f:b0:4f8:6b57:87f9 with SMTP id
 f15-20020a0565123b0f00b004f86b5787f9mr5032137lfv.22.1688211429902; 
 Sat, 01 Jul 2023 04:37:09 -0700 (PDT)
Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se.
 [188.150.165.235]) by smtp.gmail.com with ESMTPSA id
 i19-20020ac25233000000b004f6366cbe72sm3345485lfl.228.2023.07.01.04.37.09
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 01 Jul 2023 04:37:09 -0700 (PDT)
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Message-Id: <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_B174E89E-2A37-41AD-B518-C45C9760C5DD"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\))
Subject: bug#64391: buffer narrowing slowdown regression in emacs 29 
Date: Sat, 1 Jul 2023 13:37:08 +0200
In-Reply-To: <87r0psb51z.fsf@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
References: <87r0psb51z.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3654.120.0.1.15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: 64391 <at> debbugs.gnu.org, Gregory Heytings <gregory@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--Apple-Mail=_B174E89E-2A37-41AD-B518-C45C9760C5DD
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

1 juli 2023 kl. 06.59 skrev Andrew Cohen <acohen@HIDDEN>:

> Just for fun I simply commented it out (since the test code doesn't =
use
> labeled restrictions) and ran the test code, and the problem =
disappears:

The attached patch combines narrow-to-region and =
internal--label-restriction into a single function, =
internal--narrow-to-region. (We could also add the label as an optional =
argument to narrow-to-region.)

As a result, the up-front consing and marker allocation disappear =
entirely for normal (unlabelled) narrowing, as does the expensive =
buffer-local `outermost-restriction` variable.

Labelled narrowing is almost as expensive as before but is, we hope, =
less common. Maybe we can work separately on reducing its cost.

(And to those reading the patch: yes, some work on doc strings is =
needed. Suggestions welcome.)


--Apple-Mail=_B174E89E-2A37-41AD-B518-C45C9760C5DD
Content-Disposition: attachment;
	filename=narrow-to-region-with-label.diff
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="narrow-to-region-with-label.diff"
Content-Transfer-Encoding: 7bit

diff --git a/lisp/subr.el b/lisp/subr.el
index 4c462830120..37c9a422e7f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4077,8 +4077,7 @@ with-restriction
 (defun internal--with-restriction (start end body &optional label)
   "Helper function for `with-restriction', which see."
   (save-restriction
-    (narrow-to-region start end)
-    (if label (internal--label-restriction label))
+    (internal--narrow-to-region start end label)
     (funcall body)))
 
 (defmacro without-restriction (&rest rest)
diff --git a/src/editfns.c b/src/editfns.c
index b920857b664..c434fbd4d39 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2682,7 +2682,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
    records the restriction bounds that were current when the first
    labeled restriction was entered (which may be a narrowing that was
    set by the user and is visible on display).  This alist is used
-   internally by narrow-to-region, widen, internal--label-restriction,
+   internally by internal--narrow-to-region, widen,
    internal--unlabel-restriction and save-restriction.  For efficiency
    reasons, an alist is used instead of a buffer-local variable:
    otherwise reset_outermost_restrictions, which is called during each
@@ -2868,8 +2868,7 @@ unwind_labeled_narrow_to_region (Lisp_Object label)
 labeled_narrow_to_region (Lisp_Object begv, Lisp_Object zv,
 			  Lisp_Object label)
 {
-  Fnarrow_to_region (begv, zv);
-  Finternal__label_restriction (label);
+  Finternal__narrow_to_region (begv, zv, label);
   record_unwind_protect (restore_point_unwind, Fpoint_marker ());
   record_unwind_protect (unwind_labeled_narrow_to_region, label);
 }
@@ -2885,7 +2884,6 @@ DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
 `without-restriction' with the same label.  */)
   (void)
 {
-  Fset (Qoutermost_restriction, Qnil);
   Lisp_Object buf = Fcurrent_buffer ();
   Lisp_Object label = labeled_restrictions_peek_label (buf);
 
@@ -2940,6 +2938,15 @@ positions (integers or markers) bounding the text that should
 argument.  To gain access to other portions of the buffer, use
 `without-restriction' with the same label.  */)
   (Lisp_Object start, Lisp_Object end)
+{
+  return Finternal__narrow_to_region (start, end, Qnil);
+}
+
+DEFUN ("internal--narrow-to-region", Finternal__narrow_to_region,
+       Sinternal__narrow_to_region, 3, 3, 0,
+       doc: /* Labelled restriction of editing to a region.
+Internal use only.  */)
+  (Lisp_Object start, Lisp_Object end, Lisp_Object label)
 {
   EMACS_INT s = fix_position (start), e = fix_position (end);
 
@@ -2968,11 +2975,11 @@ positions (integers or markers) bounding the text that should
     }
 
   /* Record the accessible range of the buffer when narrow-to-region
-     is called, that is, before applying the narrowing.  That
-     information is used only by internal--label-restriction.  */
-  Fset (Qoutermost_restriction, list3 (Qoutermost_restriction,
-				       Fpoint_min_marker (),
-				       Fpoint_max_marker ()));
+     is called, that is, before applying the narrowing.  */
+  EMACS_INT begv = BEGV;
+  EMACS_INT begv_byte = BEGV_BYTE;
+  EMACS_INT zv = ZV;
+  EMACS_INT zv_byte = ZV_BYTE;
 
   if (BEGV != s || ZV != e)
     current_buffer->clip_changed = 1;
@@ -2986,28 +2993,21 @@ positions (integers or markers) bounding the text that should
     SET_PT (e);
   /* Changing the buffer bounds invalidates any recorded current column.  */
   invalidate_current_column ();
-  return Qnil;
-}
 
-DEFUN ("internal--label-restriction", Finternal__label_restriction,
-       Sinternal__label_restriction, 1, 1, 0,
-       doc: /* Label the current restriction with LABEL.
+  if (!NILP (label))
+    {
+      if (NILP (labeled_restrictions_peek_label (buf)))
+	labeled_restrictions_push (buf,
+				   list3 (Qoutermost_restriction,
+					  build_marker (current_buffer,
+							begv, begv_byte),
+					  build_marker (current_buffer,
+							zv, zv_byte)));
+      labeled_restrictions_push (buf, list3 (label,
+					     Fpoint_min_marker (),
+					     Fpoint_max_marker ()));
+    }
 
-This is an internal function used by `with-restriction'.  */)
-  (Lisp_Object label)
-{
-  Lisp_Object buf = Fcurrent_buffer ();
-  Lisp_Object outermost_restriction
-    = buffer_local_value (Qoutermost_restriction, buf);
-  /* If internal--label-restriction is ever called without being
-     preceded by narrow-to-region, do nothing.  */
-  if (NILP (outermost_restriction))
-    return Qnil;
-  if (NILP (labeled_restrictions_peek_label (buf)))
-    labeled_restrictions_push (buf, outermost_restriction);
-  labeled_restrictions_push (buf, list3 (label,
-					 Fpoint_min_marker (),
-					 Fpoint_max_marker ()));
   return Qnil;
 }
 
@@ -4865,10 +4865,6 @@ syms_of_editfns (void)
 it to be non-nil.  */);
   binary_as_unsigned = false;
 
-  DEFVAR_LISP ("outermost-restriction", Voutermost_restriction,
-	       doc: /* Outermost narrowing bounds, if any.  Internal use only.  */);
-  Voutermost_restriction = Qnil;
-  Fmake_variable_buffer_local (Qoutermost_restriction);
   DEFSYM (Qoutermost_restriction, "outermost-restriction");
   Funintern (Qoutermost_restriction, Qnil);
 
@@ -4963,7 +4959,7 @@ syms_of_editfns (void)
   defsubr (&Sdelete_and_extract_region);
   defsubr (&Swiden);
   defsubr (&Snarrow_to_region);
-  defsubr (&Sinternal__label_restriction);
+  defsubr (&Sinternal__narrow_to_region);
   defsubr (&Sinternal__unlabel_restriction);
   defsubr (&Ssave_restriction);
   defsubr (&Stranspose_regions);

--Apple-Mail=_B174E89E-2A37-41AD-B518-C45C9760C5DD--




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 08:08:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 04:08:39 2023
Received: from localhost ([127.0.0.1]:56396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFVep-0004l7-1V
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 04:08:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44280)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qFVen-0004kt-HZ
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 04:08:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFVeg-0007Yv-PC; Sat, 01 Jul 2023 04:08:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=omI1euf0kXT4rmfNTVRTKbiMw97F/jNDhIGTwb2kNnc=; b=HIMPHmxiRbue
 PaL3xXvRHAwiZ7INhryg+8AHY9RLcM4UCW74Zk8WU4p3WKihupdv5azs+gILFZlYzQNbbcKnEj8V6
 mVDhL8fqKospsNu9Fw/lnnCiPR/dvLXqGjwAtYeJx/GIYs3vwJe4XuaDUKrkY/UJ/KFFNhicDJbo6
 5CTjWqFVs9zT9qAgeYuGHmPdj3KqUGFposcvRcGSHaTXoDxGxqBNdTwoYKlyxJW4xiLZSamaaqvYm
 289xEmMWt9jh8aq08hcMfrHSEtHKyhQwSgFDPfTMbodmPian/oCscGDkMtFvNskCXU5WKC54BOuWM
 jaBTtyZRkBaB4nl9+Dc5MQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFVeg-0008DQ-6j; Sat, 01 Jul 2023 04:08:30 -0400
Date: Sat, 01 Jul 2023 11:09:01 +0300
Message-Id: <83wmzkqciq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
In-Reply-To: <87mt0gaxzq.fsf@HIDDEN> (message from Andrew Cohen on Sat, 01 Jul
 2023 15:31:53 +0800)
Subject: Re: bug#64391: 30.0.50; buffer narrowing slowdown regression in
 emacs 29
References: <877crkcwrm.fsf@HIDDEN> <835y74rtyj.fsf@HIDDEN>
 <87mt0gaxzq.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: 64391 <at> debbugs.gnu.org, gregory@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Andrew Cohen <acohen@HIDDEN>
> Cc: 64391 <at> debbugs.gnu.org,  gregory@HIDDEN
> Date: Sat, 01 Jul 2023 15:31:53 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz@HIDDEN> writes:
> 
>     EZ> Can you show a profile of the processing that takes a long time?
> 
> Not exactly sure how to answer this. The test case just goes through the
> buffer narrowing and widening (without modifying the buffer).  This
> takes very little time. Then the following takes a very  long time:
> 
>       (goto-char (point-min))
>       (while (not (eobp))
>         (delete-char 1)
>         (forward-line))

I asked for the profile produce by "M-x profiler-start RET RET" for
this very long processing.  is it feasible to produce such a profile?




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 07:32:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 03:32:07 2023
Received: from localhost ([127.0.0.1]:56360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFV5T-0001JA-F5
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 03:32:07 -0400
Received: from mail-tycjpn01on2095.outbound.protection.outlook.com
 ([40.107.114.95]:16709 helo=JPN01-TYC-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acohen@HIDDEN>) id 1qFV5Q-0001Ie-GZ
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 03:32:06 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=O6nkcg8ayY9EMuoN9YzHsQtVeQd4c+k1SkPjrpr+tFRppxu78qYZhxuNFmzhHKMrPtpXKt7q+BhSECg0IYK3U8DHbLi0SPktgKg/ATlZrQJuV53gCyFBtECDwpKNMa5EsRfr/l2THM1d5Yk5V9T+C+xn7neCPKsSwUmx5bsO1hIPlsyewuyGJOoiP20PNMP2mJ/j9fPbHKzmSS0wxir/1N3u6mpkEotxQ5vSo5f8sClEYs1xmolaplv6gopx2ys8A5Er0dwzXNTb8yFabTijwjyfHTL1FgTGjoWI5KWKhhQwdplVF4VWb0e0sAv4vMtVXkWYu9u5cVN0nxgp+FD2Zg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=MO9pvUUqT9jhtcYjYaw/0ztAhA2dy/dG1RNn1Q+l8gk=;
 b=GnVHB4CS8Jd+89JGz6xEn2Gkpc0cKMzbFU795rcJIPL5PKbZEZDgEw4Kk+ylXNneaHgmWJqsq6V69Ycv9PXAH1PAmlc85kZu9kDPZHesSK/ENe0FuRxgNp4W7dM3GU2MzP2S6gYqpq3EuRHXs2c1/qyUT0vmiYtxa2W2gbdA/mNfICeIrbKf9JelWQ5Pb0so51ZbHkVtQffnOxRdiiwsh8291i1QPZiXseObx/kTR29SgyqDitVVOPrRe9FJjVAje7G0RDl7WN3axAzNh9PJvvXcUDUHDCq9VEHs28I6V86MsP13BwqevZeWTVaA+LlqX15ibLijUBPDVZ8H3faQhw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=ust.hk; dmarc=pass action=none header.from=ust.hk; dkim=pass
 header.d=ust.hk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ust.hk; s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=MO9pvUUqT9jhtcYjYaw/0ztAhA2dy/dG1RNn1Q+l8gk=;
 b=Zw5DvZtzKpDWKYr1Z0HaSgluwfIClpSP4Qp3DmPdPcoXA8e8tzgHsBEFiE+nw/durSqMPhw7LWzhaRxX7wXSSgCMdlX5kvYxVw6l/cZgsmvX5DKp+W4NHPmWHstFuizGJubfseg6a/Gzmui7nBKhSwXM7ptFS69D08OzWGfQ5ZZ/0Vwbh78ZxS5gTyI0Syaz32Bkebj3Y55lufxm/ECG2YY4VsJ8ZVg7jOwFcws6rZ90JMFKUAGMC352fO04+6eY4IDh4AB0ZYWw4fxJ75qvGTcqreIMMOu6Hx3JkmsDw+jcxVm4RldbI3V53yU6ZXHHeO+ulhEmMWrB4QXMNhcjfw==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=ust.hk;
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:1bf::11)
 by TYCP286MB1516.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:181::8) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Sat, 1 Jul
 2023 07:31:56 +0000
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72]) by OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72%6]) with mapi id 15.20.6544.024; Sat, 1 Jul 2023
 07:31:56 +0000
From: Andrew Cohen <acohen@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#64391: 30.0.50; buffer narrowing slowdown regression in
 emacs 29
In-Reply-To: <835y74rtyj.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 01 Jul
 2023 10:07:00 +0300")
References: <877crkcwrm.fsf@HIDDEN> <835y74rtyj.fsf@HIDDEN>
Date: Sat, 01 Jul 2023 15:31:53 +0800
Message-ID: <87mt0gaxzq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-ClientProxiedBy: PS2PR01CA0028.apcprd01.prod.exchangelabs.com
 (2603:1096:300:58::16) To OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:1bf::11)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: OS3P286MB1877:EE_|TYCP286MB1516:EE_
X-MS-Office365-Filtering-Correlation-Id: fcf96019-38a7-4b6d-6925-08db7a053f94
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: qPFho6z8vnNjs99lkFjNykgiDs80p6s5skOahogAJgRbvhL+ED5AzggIj5bIsBVAy5Yhkv21QyUxbL6eYIQFhda0F8oMyzmAgg9HVCaHwX786LrifK7L+VQIrLR7ZLPTEupzuEzwdMxidm2YJ9AhJOVVebROTPNi7ivYELIZsvxno1Om6KipgzFKD7wYBm6kMK+pXgbegxaQunk+vr5YqD2VM/ijK4txjhvDBK0ltA6zZ6zmyFeTGctwLXsRGN18bEjJriq5afyUYdIfwbPPU7VN49/DQp5Yduo1Q3JHSLSO6gLW7EuCiCUDSdv1i8VH5gKgR5jqboRgIceUeXQxw2eTpx8dBNes0aOdPzcNDjbG2HL9zlDRWpdmjIy2Y7gByb0wRw0i6jkDBneIEtvtdtmn/m6n9+aKc0Lijws0BRnL1ELnuvsg8+Lk4uee77iPWo9r0l6EONJUW9bWhbhPB0nSeGpYMPCO251eKBu3HETwik/VQA4OVyl5BJKBLNQacPb1pceJIZNUa5KwpDmob8se0NmofXSDYcR7E5LSWnApoOTdiyO8CXrGXrLjqEKW
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(13230028)(4636009)(366004)(396003)(39860400002)(376002)(346002)(136003)(451199021)(4744005)(2906002)(41300700001)(5660300002)(8676002)(8936002)(36756003)(86362001)(186003)(2616005)(478600001)(26005)(6506007)(6512007)(6666004)(6486002)(786003)(316002)(4326008)(66476007)(66946007)(66556008)(6916009)(38100700002)(83380400001);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?okRLyyJo+8THRp1Dvl32yFmKUjtnvXQspMcRjBiJPXpiNVJ8XZCrl3l9XG/6?=
 =?us-ascii?Q?3xq7idgYhCLw4WsfojocaK5HOPEHzIfpe9kYPTCrvES2A7oFww5bib+Q7aQo?=
 =?us-ascii?Q?wsktAVmfYyS2W8W0MFRFL0+HEAX+RJQN4s603N89ZroMbvII5U0DKssAhtk7?=
 =?us-ascii?Q?y52NY0YHIrbwq1MsNADMFhLLFOgoF2a3+4sKr53NUQkJvxCxQGyEPsfI6T2T?=
 =?us-ascii?Q?YBGxvjivlHR/ztKHGaBiDJB5VrbRgtTdmdsH8QuVBT2D52xEj3GMnLmTckxK?=
 =?us-ascii?Q?UlSWkQa7CXOmKE3vdLk7+Nt4GBtFJS22n/1FLOOy0pFBOpwtnyZliFwM+RHb?=
 =?us-ascii?Q?RfeX6BqrMgmasoiRnBJuwGiaPW/10zbFMnyhZk0/5kWt7RQGzVzGib5EuUA/?=
 =?us-ascii?Q?wQjEvVdFL3nhONCQ0QWTCnYnao30Tbu8OHDhHmsszhs9M9h9r+BTMJJIhNWR?=
 =?us-ascii?Q?fTFLdUuwnEseBqN2XbeFJeuOqZBccXBCvjvwftV1PZiYjvBH3WkI2bdO5r0P?=
 =?us-ascii?Q?OyWvpAnQzICuM1WThro8hjkgTsszJ9a6yDTzC49jbw5S3dSrCCs7ML/UwUil?=
 =?us-ascii?Q?LfvYL7kmQy6Tm8WH4qvLXAOnK6waOPf6UU89O2zoRgEg+0otVQAqJLo4qe1I?=
 =?us-ascii?Q?47F/tNGtsbl2udjyIyG+ZqYaZRp4XKyBRQ1/NBSHGUfgIJVVTOBTy1FM67t/?=
 =?us-ascii?Q?ylriLQj6sLUA0JI6MIES2Q9GJMkalEfBNVE5cmRxKvPlvATOUoIhkHSWcvUR?=
 =?us-ascii?Q?Qv71p9rusPMQ1wfaax9PzLy9iSbaW6ENRRNsvtxpgCn/iDXP8TwoD0U4maZX?=
 =?us-ascii?Q?HlsLvBd953GmpsakQuAs3XF0dWj6jOEqJlD0/Tp4eVZdrQTgfkUAuS9yMmS/?=
 =?us-ascii?Q?mqUh4dIp1GlFcyKpIbp3wbi9IsantV3pgPJ+6wbRowcADn+KiQu/5vUwGqXR?=
 =?us-ascii?Q?744l3kaRN7EJ1QapmF+LLra0ukYzoTbU+GbsDb0MIvTMB9wtxD6hUEwDVGUI?=
 =?us-ascii?Q?6Uwi7csLSdix8qYNzt9o58fstWDjAg59QnlwuDvoiLv8QPQPG2T1mAmSOYHs?=
 =?us-ascii?Q?/K3PLyXwTMJM/RutzfBupQcVAjqsErS6ngbwDhonYouknwKnBC2Nx4b5PVKy?=
 =?us-ascii?Q?huzCmtAFguUqpTS/MIkXskP3hVfsGUDdrJnFWPxxbg2NAX4JDbz50OP7AiPo?=
 =?us-ascii?Q?GZQu7EYcnWcNYI0BjV0af9ztLU1qX/Wb3IF+lJrngLq8bpgbK+oO6C6LWDEG?=
 =?us-ascii?Q?+hahapwiq08U9EmUom8PEAYQQS71WkXt2NAxlgAmYeQcXKQCKJTx/7vzz65X?=
 =?us-ascii?Q?Db8DCvhA10RGAcTYOmzIfEOydDV3GArT1bi1Uy8mNdCgHB5Hm/S7eR4fji5F?=
 =?us-ascii?Q?3o4baO74OXQn4OY66Vdmlw7FJkb3P6m2Q/fiS0dsv7qT90V3GQ+IHraFAmAu?=
 =?us-ascii?Q?wNCyujL3nR2dyxXMD+suQy8WYh62xTB4xFxtr/LROe/sGOWehVng5x5xUh9T?=
 =?us-ascii?Q?2aHYCMzBo7nToX9+I4G/9kDHwi6CrcYsNgEufG5uZ7zYhvplK3ZC/TSJpvd3?=
 =?us-ascii?Q?lXjsq1sMQ+g5nN9O5SRjU0GNs3UL8GJ+aYBCLr4t?=
X-OriginatorOrg: ust.hk
X-MS-Exchange-CrossTenant-Network-Message-Id: fcf96019-38a7-4b6d-6925-08db7a053f94
X-MS-Exchange-CrossTenant-AuthSource: OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 07:31:56.4428 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: c917f3e2-9322-4926-9bb3-daca730413ca
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: VuzRJo4uexRdeNNsUEYVXGjvPCRblBiX2kqUz7OL65lIZqdR/NEGPz+mW1SNl6g8
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB1516
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: 64391 <at> debbugs.gnu.org, gregory@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> "EZ" == Eli Zaretskii <eliz@HIDDEN> writes:

[...]

    EZ> Does this problem go away if you set long-line-threshold to nil?

No.

    EZ> Can you show a profile of the processing that takes a long time?

Not exactly sure how to answer this. The test case just goes through the
buffer narrowing and widening (without modifying the buffer).  This
takes very little time. Then the following takes a very  long time:

      (goto-char (point-min))
      (while (not (eobp))
        (delete-char 1)
        (forward-line))

-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 07:06:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 03:06:38 2023
Received: from localhost ([127.0.0.1]:56277 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFUgo-0000bM-JP
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 03:06:38 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54660)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qFUgn-0000b7-0Z
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 03:06:37 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFUgg-0002a5-U5; Sat, 01 Jul 2023 03:06:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=CpIbZVhOfKDQiQ4ZXhtd7jmGkTwxde0YbvUheP+GPYM=; b=DeLpDOxFOgxImHmELbIW
 xLUgkR9QzCthORnqmeOgpmA11JT6JXBFwDrGLZcYbPoZ3wqZ63KxUYS1ivbcipU7B4BDP5ITvkFd6
 vDLHv/KbLgym5+k1mlSydPk7xdUMe5J9GprevzSy58CjBjUYYhW/HijW97PibAqQUaRUbDj2POWTg
 XRf3/DxggG2hzwjmutDR5tyBOW8xy1TI3LyaIfhMFYBgL3naSfp53oTKevXYTmmw6q9E4R0Z8jt8P
 aIrBDoiNPZxnAxnXWtmMGxt//ytkueVjWSHtow4OstwaHxewd/2YQ7lx19U7ZVqHF03L4i4LrzD3A
 YJLcWcv9AjR66A==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qFUge-0000BZ-Tp; Sat, 01 Jul 2023 03:06:29 -0400
Date: Sat, 01 Jul 2023 10:07:00 +0300
Message-Id: <835y74rtyj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
In-Reply-To: <877crkcwrm.fsf@HIDDEN> (message from Andrew Cohen on Sat, 01 Jul
 2023 08:15:25 +0800)
Subject: Re: bug#64391: 30.0.50;
 buffer narrowing slowdown regression in emacs 29
References: <877crkcwrm.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64391
Cc: 64391 <at> debbugs.gnu.org, gregory@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: Gregory Heytings <gregory@HIDDEN>
> From: Andrew Cohen <acohen@HIDDEN>
> Date: Sat, 01 Jul 2023 08:15:25 +0800
> 
> I have noticed a huge slowdown in parsing email headers in gnus. After
> some debugging with help from Mattias EngdegÄrd, the problem has been
> traced to the narrowing code introduced in
> 
> commit ba9315b1641b483f2bf843c38dcdba0cd1643a55 (HEAD)
> Merge: aef803d6c3d a3b654e069e
> Author: Gregory Heytings <gregory@HIDDEN>
> Date:   Thu Nov 24 14:21:30 2022 +0100
> 
>     Merge master into feature/improved-locked-narrowing.
> 
> Gnus populates a buffer with headers from a set of email messages and
> then parses them by: narrowing the buffer to the headers for an
> individual message; parsing the headers; widening; and then repeating
> for the next message.  As part of the parsing the headers are "unfolded"
> so that each header doesn't include line breaks. I noticed that for a
> long list of messages (10,000) this takes between one and two orders of
> magnitude more time in Emacs 30 than in Emacs 28. Unfolding all the
> headers in the full buffer before the parsing process removes most of
> the slowdown. The slowdown seems to grow quadratically with the size of
> the buffer.
> 
> The problem seems fairly general and Mattias has produced a simple test
> case to demonstrate the issue (code at the end of this message):
> 
> 1. Create a buffer with 100,000 lines each containing two characters  "ab".
> 2. Loop through the buffer narrowing to each line, and immediately widening
>     back to the full buffer (so no change is made to the buffer
>     contents).
> 3.  Loop through the buffer removing the first character of each line.
> 
> This takes a very long time compared with reversing the order of 2. and 3.

Does this problem go away if you set long-line-threshold to nil?

Can you show a profile of the processing that takes a long time?




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 04:59:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 01 00:59:35 2023
Received: from localhost ([127.0.0.1]:56143 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFShq-0005ch-Ob
	for submit <at> debbugs.gnu.org; Sat, 01 Jul 2023 00:59:35 -0400
Received: from mail-os0jpn01on2124.outbound.protection.outlook.com
 ([40.107.113.124]:60162 helo=JPN01-OS0-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acohen@HIDDEN>) id 1qFShn-0005cQ-Es
 for 64391 <at> debbugs.gnu.org; Sat, 01 Jul 2023 00:59:33 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=OlhhYe3bV7m5342UMqKfUtVBJJ+cldHRHJvnm8bUfTXI8fqPSdWeoXhRdWFIZPeft1oCmdx2d8DumUxyPsmmbTVMdQ8E6ZHHqtSJGVJV8CBCwBsQjcv3UV1yC3MXU/iWN9cGM5QRRtigKYSotnFvEcNzleJYni+y9F5nomcUe2QChjao56q9+R9TAxf6mksWvyz7bO05iaSmmmsMeo5u0pTSMb0BZp6eGva+RpmiQdyo8vCgHUZZ53CfsPOdDvkQ7Smxo6/t2n3ogHv2cM5zQnIdEyY6xQY8Z+4isL7hfXRtk07smGtlsYphXerNwtJWZUfb7wJ8nIgzqmVTFNxzEQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=HpKZZ4riTJqfl/ZDxLaslJOAnfI90U4iWFCHvoWBe8g=;
 b=ldvtklq57oy0/ZOkE712+iA0EQiOgrZyXEgtDBcRX5pRqIjaP6hrANLx9rp8FQo+svu+9S4lSLF3l5RM8O324tGHiE9ZR4w4rGO+fGpibUgCy4n3kbzzMeviVATtrZ/9oYbmvblHdxq74pM0zJjL0tiZf8KVWLDSsLWArj4RxkPYIU+V6h6VOyXrHurkrxqEbaOYDkGPEQp5zOvt3cpSVcXKDJ9elXUH3ZUmCLi5lF0PP5DMGc2xWl1DP6CR8lZFzx0tzKgj8cCvvpy9P8EUNvNLwL8ho798ZrVIHuKNa93OFgclw/AKLp/WtiDBDLBOn4GRLoCag2Bh5L4YKqMq5g==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=ust.hk; dmarc=pass action=none header.from=ust.hk; dkim=pass
 header.d=ust.hk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ust.hk; s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=HpKZZ4riTJqfl/ZDxLaslJOAnfI90U4iWFCHvoWBe8g=;
 b=xcaZKVx0gdY6OsBoerXN9qSmA7+Un8ydTcgqzD09bo8m6f2/e5cxUPBojZY+HQq3vDQyEngjan9fdSeXG6mAZXsOj1yok+662mhm6pLv3wc5t7MdOOFcoDNFR2HwZsk+WXBv7rcDq7FcOXFSTyVZ5Wf559AwOolQoSBqB3PkVU6PdyYVnEpuLft5VfztPDjOGwv6v+tfkWTOPTOE0bZlXquvP+tGtlooCvjS4UBkhet4DwkqLqnoLkQyw8qUssPfLoJUTK21uxRlUS5HI/X3X9ym8wsam4mGLMJHGAeloPyem3gpoyD1c6RyjduVjkR7izCrDg6EJP71RoLXV91A4w==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=ust.hk;
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:1bf::11)
 by TYCP286MB2382.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:188::7) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Sat, 1 Jul
 2023 04:59:23 +0000
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72]) by OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72%6]) with mapi id 15.20.6544.024; Sat, 1 Jul 2023
 04:59:23 +0000
From: Andrew Cohen <acohen@HIDDEN>
To: 64391 <at> debbugs.gnu.org
Subject: more info
Date: Sat, 01 Jul 2023 12:59:20 +0800
Message-ID: <87r0psb51z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-ClientProxiedBy: PS2PR06CA0009.apcprd06.prod.outlook.com
 (2603:1096:300:56::21) To OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:1bf::11)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: OS3P286MB1877:EE_|TYCP286MB2382:EE_
X-MS-Office365-Filtering-Correlation-Id: 1d2a13e5-0823-4b3f-0e6f-08db79efefae
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: bACcyAA2R6nV3J4Vaqkg0zvmSxCMcKN2MwC/uJZAYCctWnImkgQr8Vdj2eILun4jz79iE8mH0inY+VKPawPkr7rdrWNwOSM5Sabg0VP7xQJaNiz9lbvreSeV42BH4Qtssh/PXeameP2SI+Ok9w7is2xiSsa/DA3cpBBBI3zHj3UJfnbTeoJzrtA1bpE6CazZTq1PuTKt+Y6HWusXGSlRlxh5P5Wl4EE/DHD1r+KWlhqoaktLK+uvJci81KXz4SNpLujY9oVW7ToHk24tfpl20WiIhbDKVz1wgT3DnWA9Zk+y+8aL8H0mlVV3NR3M0CcExOOz957IrGu5LeRsteSz7M5siqx8LUzfvoe7fpSSj4dopxh+QseQUFGvWjmu/O0Q+oZRk01Ly5nokOUNlyTprRxDb9rTDAH6eAQScOkWr+/L77O1Hvv8vKcoJ8ZLWDJA7+E2mVdPZvcPTMb+JyWCaw81tf8Mk28Mj4njRtRkosY8ZAAZeEzDKcLHhBiR3QUs9BPEi3Z00vdeJWItT9wdn+Bqd+N6tj+U0MxP976PGwnHxzKdQwtjwa6sz0XkeM8T
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(13230028)(4636009)(346002)(136003)(366004)(376002)(396003)(39860400002)(451199021)(6506007)(786003)(316002)(66556008)(66476007)(66946007)(38100700002)(6916009)(4326008)(6512007)(2616005)(83380400001)(186003)(26005)(478600001)(54906003)(3480700007)(4744005)(2906002)(8676002)(8936002)(7116003)(36756003)(5660300002)(6486002)(86362001)(41300700001);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tNiIVF4uGN3zDNUpbk0TOyHmWYlyJRlPFTa43XxVxU9yKMXMRBXkseqVCGa3?=
 =?us-ascii?Q?lW++SdMFZjuItoS6SE3+DPGHdoFlpd7UbChAfoIMP4Ev1OrV4gAYAkRYk8+1?=
 =?us-ascii?Q?YjyfFx7W9k5d9rwB+yigCf1M8lnQAnruFF0MwQ5sSg6xDYcyXiaz8fa5lbnG?=
 =?us-ascii?Q?P4VEklOzaSOq/usBivr6YA+T/rmgNcCB8ceHRSCC/djU9z3LKhgkYod36gVQ?=
 =?us-ascii?Q?tfIYGhjOEh2IsnYCrZGTZv7DAJplpQdfvm0aPrNquyBm/uftx3w1eisDFob8?=
 =?us-ascii?Q?moaJ6ggLA8ko5BlPZL7p9I7qkmIqCkYTBywQz4FWLys1AzDYWY7vO3FDDuf4?=
 =?us-ascii?Q?PKmVWKzuqTEQcfOQM8BnReXQE1ZLwIhioEiFQeHSoOPf4EolxppV431kpnBs?=
 =?us-ascii?Q?yMxo2TuPidC9AxIdFZipPz/dnJvZIt0ke2TQcQGB4plUu+tqyjPtgHN2BfIx?=
 =?us-ascii?Q?LOokZq3kd566FP8JS+KRppiTF0p6FM/hAaJ2dlrIb+nZv+nm2rmKV8/qcGUY?=
 =?us-ascii?Q?IGvMaF5f2xGlz9zIR+wdgWDhZjDG0ly9IdJ3mCZwpVbFff9DFmgNnariau7t?=
 =?us-ascii?Q?p7TjnqPKl9peeyiZSdMWeZMYfeJDv8HNh7uN82v1oN4jR3Zo69bI0NoOIu8U?=
 =?us-ascii?Q?4cgZsEKan0Bnjy8qQtnVyAefZJpa4k4dTeThanPsv5BMXwbx3b9oQLx9IRbo?=
 =?us-ascii?Q?qyJkmmbOncwTa/bhNdEA+Y+hAdObAvEv21P7XHHo2IsSqTH34zjJwPNCUqJN?=
 =?us-ascii?Q?Ful6C5q1qnE3oOOc3/RI0FgqdUDA7avPS8mcCCjNpRp7X767A6b8I5Md6DYG?=
 =?us-ascii?Q?+vNnPfaWp/LYLIxzsRnXHxyscHPhFCz+Rv6w1i+LGKyDb6b9vpt6HTekYkj6?=
 =?us-ascii?Q?vfRnDBT2+48aUbq7/nXhJPS1PmSbEIxBllLqxcs/s1lwfFNCphBD6fF76Qn8?=
 =?us-ascii?Q?k4MXmcWLBeXOo3MB1BdKQqJ/DMUuitIzZ+zbl3ly+Hyt+4uShB1X94nYt0UL?=
 =?us-ascii?Q?lhhiofdwajS9kKWT4dfQ5kfpHxXPjaiDKhuTtPJfDVSJ7ssli7RyQ2Rh8oV8?=
 =?us-ascii?Q?ydClwPbywZd788a1nUB2l0lBu5UmRhXd9AtZC2PHMbyWbTclL0ba5eKu1Xj1?=
 =?us-ascii?Q?mqQO5k0DXZftH50ZtkmbS8k/wrNjRyW+C3IziA37LSldG1v66o5qgcwB+uTR?=
 =?us-ascii?Q?YYenvSMvjNNO94vlXpXuFVGw+wdxCTBwUEyzvC7/620YAevUCmBAqLYwi0Vf?=
 =?us-ascii?Q?oYZX9riih0D87pAsC2jBtCJ9SSLjBFgLUWeUxpT7gP0PW0X+nkXMqZKL3uS4?=
 =?us-ascii?Q?n2HgHiv3HXMx2xg8ZlIW98jI1Q/19bHX0bi17TNtdfKUkzFkOerOqTo9BoZc?=
 =?us-ascii?Q?VZgFckpjRRN9OFLkeplQ2+amQuvj665C4NRYXxyQ6C0rZ2Rj/NRmbxnD2vfl?=
 =?us-ascii?Q?mBDH6HhFqLI5ZA3FaAfbCLO70lG7y5YjBm1XXz6bNI9euIAwsImgOYvlpYIk?=
 =?us-ascii?Q?wN+/dnzvjievUW31z5M27/m79WfOlYhknkFqX3qZiYNwiaCxOIKKsVMXpChV?=
 =?us-ascii?Q?HCJNl/PeherKLeccQOAGAfokjFpou2OTpd71mBg0?=
X-OriginatorOrg: ust.hk
X-MS-Exchange-CrossTenant-Network-Message-Id: 1d2a13e5-0823-4b3f-0e6f-08db79efefae
X-MS-Exchange-CrossTenant-AuthSource: OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 04:59:22.9964 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: c917f3e2-9322-4926-9bb3-daca730413ca
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: Z8ztR/YXQzo+NkYq2GxuG12Z+9b0I8wNMj2vaz7agHr5EVWdgBcc3QB6Y3bFaqiD
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB2382
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
Cc: =?utf-8?Q?Mattias_Engdeg?= =?utf-8?Q?=C3=A5rd?= <mattiase@HIDDEN>,
 Gregory Heytings <gregory@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mattias had flagged this code at line 2948 in editfns.c as a likely culprit. 

/* Record the accessible range of the buffer when narrow-to-region
     is called, that is, before applying the narrowing.  That
     information is used only by internal--label-restriction.  */
  Fset (Qoutermost_restriction, list3 (Qoutermost_restriction,
				       Fpoint_min_marker (),
				       Fpoint_max_marker ()));

Just for fun I simply commented it out (since the test code doesn't use
labeled restrictions) and ran the test code, and the problem disappears:

Emacs 30.0.50
Modify after narrowing:  0.076 s elapsed, 0 GCs, 0.000 s GC, 0.076 s non-GC
Modify before narrowing: 0.070 s elapsed, 0 GCs, 0.000 s GC, 0.070 s non-GC
-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at 64391 <at> debbugs.gnu.org:


Received: (at 64391) by debbugs.gnu.org; 1 Jul 2023 02:45:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 30 22:45:50 2023
Received: from localhost ([127.0.0.1]:56054 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFQcP-00021a-Pz
	for submit <at> debbugs.gnu.org; Fri, 30 Jun 2023 22:45:50 -0400
Received: from mail-tycjpn01on2114.outbound.protection.outlook.com
 ([40.107.114.114]:39945 helo=JPN01-TYC-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acohen@HIDDEN>) id 1qFQcN-00021L-Ap
 for 64391 <at> debbugs.gnu.org; Fri, 30 Jun 2023 22:45:48 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=RgHelxZrbUhM5ufR0qWq/45/QvwYmF0pN8EyC1LYqE5n+nYS44vdcKsATExJe8+e5KkmLsevIrY3ZgKe3zzX2CQlFwdQt3FuvYWuVpr4dLl8A74fsFq6AV33NaxJzDkMR4C4/ns1dRH4X+JSk93pWBr+RIWSxUHwUArYtWQrWXvxxNiIgvbze905pgNYpcoRFjSGajBXApyxuKeIYXzV4zdCCC9HuJVvCVha8ilXRBk5AFnkZSNSR+tITmfwn2VO4dF2BTRvDaRu+1rt4dEvLYjrg6zCZBPhHWpTGHxOdQt+9d1J1JX9AfAjbsnsnzSsFCgISmr557coqar9Ed8NHg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=9UBcCxiO20Y9LaiuMcoZCNTakXGbu13j7zuTNgKzoXQ=;
 b=C3Ss1aKCDbeLRM2+Eltt6G5BkaKPVQPY+QCihBpF35Zlpzj6uEGJrhNGiu0oZ0RQln9okJVgH2cuUt5OAbRuPJkosg7LUiZAZOX8jgvVGQ/U5Z6vrccURxzK5WDu2tLm0uQ3FL0dp7tsNIuUyL+GoMmRerTosp76XpSY21CMvR72sBByiRf2U+UlRlBcuH8mjPrc2jdEgQegx6jkEWHYYlP1gTg8qJzTgtR8hzutCOTV1oFlXqIAiYrBcq1AJxVWvMObfXMKlRpIxuBT2GnA4oP0zTSoZDgavSfvClW8GI3Wsw2zlCPofxToLIWL6yxD+69sPEXl7SVWXsSjES5kCQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=ust.hk; dmarc=pass action=none header.from=ust.hk; dkim=pass
 header.d=ust.hk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ust.hk; s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=9UBcCxiO20Y9LaiuMcoZCNTakXGbu13j7zuTNgKzoXQ=;
 b=zlw9lgA0XV6rxnmy6ceKT2tAaXf3MwTFzp/5KdvUM+4GGgj6eNLQmX2CkLQ6WJErIHjGvnEm41dMdNlqs2cCZENPvd4OMbiZQvVmcnVmnhbvGqXKdQEeUMXdpkjuUcR/tOI2sfaCV8WR3wO6UIYS2DTVCwZ8ujXNc+Gz/rQcsH1lk+D+QUaAcJSNmgiShzkM5wigp8pprd0CO8EJlpo/A5V0gFmlOON1qoJa2Byj3BOXalLtMtXkk8OoKDqm+KoVDfQdmmlt8osbvnLmICy4BtAGin9+5+bcn+85nZHPlo7TGoiz3wPIlTHbbNXmlilU2MOI2S8C19CEoqSx2sLgRw==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=ust.hk;
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:1bf::11)
 by TYCP286MB2226.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:153::8) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Sat, 1 Jul
 2023 02:45:39 +0000
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72]) by OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72%6]) with mapi id 15.20.6544.024; Sat, 1 Jul 2023
 02:45:39 +0000
From: Andrew Cohen <acohen@HIDDEN>
To: 64391 <at> debbugs.gnu.org
Subject: bug 64391 wrong git info
Date: Sat, 01 Jul 2023 10:45:35 +0800
Message-ID: <87zg4gbb8w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-ClientProxiedBy: SGBP274CA0004.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::16)
 To OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:1bf::11)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: OS3P286MB1877:EE_|TYCP286MB2226:EE_
X-MS-Office365-Filtering-Correlation-Id: 81deaef4-942c-4ad0-8524-08db79dd4141
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: AylHv1E9Jgqqz5HvgeopeKV9Lnx4kHMEWReB/d9YyMlct2AifoOkfMm777TIvWNzW1NrX7kSW/0rW/M4rkExX/BBi08zbeRFc86wZtja+dMSUvhwMf/A+y4b0BbZzq5punlL5lrLMuO5A8h/qfw9stsYDVK5q6zTxOxrElr1vPHZ93BRx/p0XKMYNiQDrEsIsPyRDcdqvk3F/pechJeIxan+IaDSQBlVbNDxLN6swjgC02nvw/Y9OSI+F9+4pm8Pm9mQEHCXROJuf3uXGax/IHn9bSAvU0+SejS5tA5sr8SegSNR9ebikZp6L7zCshPVI9IisIE5DuGBY9DyFJ2D4YHZhymGuukVTbKKNqiskE/erswZJ39bX1UQjUk4BT5s/4tw0AqV1mn/AvkmF8dByuAQoYWy65vZpOzQDPZ8vdNTiSHAILjYjjikfcovDEwU0Tvp6/Z+Wd0jJZ4ofkKN5Mpu43ZoiQfXnwRiftQubPE+xelG6L7KBmAqhL6ZfK2lHUmrz++qU4eqWojXS7j2CPNM0oKUEg1+4UjXWC31Vgni2/sUN/8RT+UZ9PdRS7VM
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(13230028)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(451199021)(6506007)(5660300002)(6916009)(66556008)(786003)(316002)(66946007)(478600001)(36756003)(66476007)(8676002)(8936002)(2906002)(186003)(4744005)(41300700001)(6486002)(6512007)(26005)(86362001)(2616005)(6666004)(83380400001)(38100700002);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+1mJxfe2+WRczM15z8qOrlmeDtmZlLmmzKUTn1CC5eXyKQUYCEjt0OiCbDfo?=
 =?us-ascii?Q?Vxe2PhrEPVQ2V2bxz+gDXu7oU0vXepj1IYv4L6WilCqi+hIVK0Do0DBJzDV5?=
 =?us-ascii?Q?89TPxMlcDU3YkOtL8Gvj9cDuFEpRlF0Bh3aizaiJ4N/QbnwgJmnXc91kXpjw?=
 =?us-ascii?Q?uybpgV8o7E7Ovk/ObkRNqnU5pwJ/k4F/3Obe8jsvisuVGvYP+5CXwYG0tL58?=
 =?us-ascii?Q?FbKm00DYGRtTAidJbCfa7NqlxQIdn16ID50yelJkLc/FaXsyIPK2DUa3gFkG?=
 =?us-ascii?Q?pBN5ffgG+uqmunhXKF6YMmI8MHoKUtgJl4jlnBcPlQChJ4NqSWcYe8nCbQtO?=
 =?us-ascii?Q?Vmd1mLjl/QCFHoW8IO9F63tWnmGX4ftAWjaVBQB2ga2J6dvKNxPNWopaRQtS?=
 =?us-ascii?Q?cJLDVaR/jRsYm4ojGUMF7xZAOzNEGwyZqtwjcOHzvxmPAtuqD7y5zzz6tb4C?=
 =?us-ascii?Q?3ZQ7u59lmVZIWzCreRmFQxY3YaAieaS+ppp/O9WeVPmtJgnmc8SjkcFc5WlZ?=
 =?us-ascii?Q?RbJ6omqxAw9RwbBg/jNiOWkYiOn9mEVhzY6D9ODFDN3Djky/hCV9IhCVxe/x?=
 =?us-ascii?Q?Wa0DiT+j2Jw04XAHDflcCbCj8Hn83GiYqtec43+Q66KW1Sevz4qfuViUr+8Q?=
 =?us-ascii?Q?q4IcL+UPzgrSZB6Tk+ZJT2C1T1c7qdxFuV3QwpoqnPrsHC2avN4S966iyLQG?=
 =?us-ascii?Q?3P6AYbgRgC9vuxTJA4YwE3QpB8GeJPGNHWg4awExHLosOxZXcl+Z5/9VUIDe?=
 =?us-ascii?Q?MmypdEIX974GFYUBhsTDGFeU8DNpa8YlND9gBILXE17ysel9SOBWVcgIfcuB?=
 =?us-ascii?Q?eD+8D94Re30VpCpJdIEvEm9lvvdOFyWdzqcBgST6LboPdBuV5GmZ7MgWgxjA?=
 =?us-ascii?Q?M9vvBZ+jhRENqiVZcXzwNGrl1nupE5LsZH9YoN8t/AaHyk5CZH+o9R+a0/PX?=
 =?us-ascii?Q?fdODLce/wxNrRlePyx3+/PVd02BGgG5OR8xKnPRPwkhMyWMtsbJjQtwW37o5?=
 =?us-ascii?Q?8QTt5sYbuvDBHxzsJzFrRRuJdKTW3zDwmW5H7hYv9lMGtd1vo0FVlpBMW7gI?=
 =?us-ascii?Q?PxZiHVTLqFbJ20mBVmQs8DXoWtlbCw5J8T0bv0VO4t+mm86FIm4NVY8sWHE4?=
 =?us-ascii?Q?iNKE4ufb0//v79NRvc9BO2XxDeEMkl0y7tqkiLDK36MS5AxkDFzLJ16JFcC9?=
 =?us-ascii?Q?RxosuuPqmq7RQCvgKFllk30iLNClgzi4nljIgkTLaXxVoGoYac1HDKVIOvxm?=
 =?us-ascii?Q?xHNkI/nR7p+EEQdUfogP+u774aY+TMjaDQKR23UVcDA/JEc/u/CKZNPb9H6k?=
 =?us-ascii?Q?k5C8neOH59c4PM9Gt3c1xqqYBNwo/gVJGL/8apqU71y49meo/XcIX20TajC2?=
 =?us-ascii?Q?ucsT5NP2hmMX9LIP65M2HlKPTwudvClWinhvpws9nQQXfb8s0n8qM+ucaRMN?=
 =?us-ascii?Q?EJci1zu7fsdJA0bSMpupQ/5f1Z7F5iECwdD1mHj9vIhWr2xvTzYL0fMdI4Pk?=
 =?us-ascii?Q?r4BsLlT/eNd9g0FrCvLlDEWE/CxzIYW7njO1wlRY8/NbNRApHzzS0DVRSBDf?=
 =?us-ascii?Q?8QNMgcxmFwJ9zLp/TmiPfyaHgfvbgdjaPnK6/hiA?=
X-OriginatorOrg: ust.hk
X-MS-Exchange-CrossTenant-Network-Message-Id: 81deaef4-942c-4ad0-8524-08db79dd4141
X-MS-Exchange-CrossTenant-AuthSource: OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 02:45:39.3461 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: c917f3e2-9322-4926-9bb3-daca730413ca
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: h9KPBeZjDWNayg1gH+3//ha28FzOQ3gqTxpy7MeyMKQ1ET8CeFiLjcNUu7c7aqk0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB2226
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 64391
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sorry, I didn't give the right git commit info.

The last GOOD commit was

Commit ba9315b1641b483f2bf843c38dcdba0cd1643a55
Emacs 29.0.50
Modify after narrowing:  0.080 s elapsed, 0 GCs, 0.000 s GC, 0.080 s non-GC
Modify before narrowing: 0.073 s elapsed, 0 GCs, 0.000 s GC, 0.073 s non-GC

The first BAD commit showed a slowdown of a significant factor
Commit 9dee6df39cd14be78ff96cb24169842f4772488a
Emacs 29.0.50
Modify after narrowing:  0.734 s elapsed, 9 GCs, 0.051 s GC, 0.684 s non-GC
Modify before narrowing: 0.153 s elapsed, 9 GCs, 0.052 s GC, 0.102 s non-GC

Then a further order of magnitude slowdown shows up around
 Commit 321d4e61551a0f6dfb1abfc0b54e6177735bde58
Modify after narrowing:  7.954 s elapsed, 3 GCs, 0.022 s GC, 7.932 s non-GC
Modify before narrowing: 0.122 s elapsed, 3 GCs, 0.023 s GC, 0.099 s non-GC


Hope this info is helpful.
-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Jul 2023 00:20:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 30 20:20:52 2023
Received: from localhost ([127.0.0.1]:55990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qFOM7-0006W2-SK
	for submit <at> debbugs.gnu.org; Fri, 30 Jun 2023 20:20:52 -0400
Received: from lists.gnu.org ([209.51.188.17]:45134)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acohen@HIDDEN>) id 1qFOM5-0006Vp-0T
 for submit <at> debbugs.gnu.org; Fri, 30 Jun 2023 20:20:50 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acohen@HIDDEN>) id 1qFOLu-0003FB-5p
 for bug-gnu-emacs@HIDDEN; Fri, 30 Jun 2023 20:20:39 -0400
Received: from mail-tycjpn01on20718.outbound.protection.outlook.com
 ([2a01:111:f403:7010::718]
 helo=JPN01-TYC-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acohen@HIDDEN>) id 1qFOLr-0004jG-OW
 for bug-gnu-emacs@HIDDEN; Fri, 30 Jun 2023 20:20:37 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=X7DaTMMktfQXG50wmiteM4MWshiclsekFgj1V14izVkeKywmEqpiREwUa7XTrx4EB1pxj3gX/Z4IP0IhXgVZU3Jx7WTCjqTnlD8/i8W0sCHF0mYhE4vInm9HRHrZKtONZh46Ah6bVDryu1B+0e9xSdUhDtHmt00O40iMfUpOc1ndGHaSDObWSW6VyGHX5cfiDJJi6o7EURAxLvIFn3YU9j/adj8epGX7lT5AiL6xghNgrBKP9VHvAKE/VDbIs7jX2W6uQZTxBhihwgat5zBku9vGrcikhXbPAD8KnopPPOIs+uArsBGoLxk/aPc/fsMmT1iK4Yk80hM6xQvjYhjsVQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=XWlBs6nHF4bbgSsIGbncIRe7MbtENRoWDQWDVECFKkM=;
 b=kaFutaVVg/681/ju1IpkGThXPTr2r5LgdU0P6WdMmmPoBXDktjD7JbLfzaSX2CKeMqxRGbrOjNz66/fkXiCSvok2o7SXO30AruBKnFjVBxgosZgIXVj68YgyZC6GkcyaTONwdDCq1tb+ey+A/WEyV/Uc07uYryA+rDdG4YhTqhgXuy9fs3hwRRddBlfV9LTFl9Xc09og8y8t+2jx4lNcrBg8XsH98XYU6xRvHKxI8V2t700NL6xWIHY/JxhvTxY/Z975hEyyd9kUC4c//p3IbgA+JSrGCQ1qm3FQtumshFA3PSGGEeUjvMYd4eDt647KUgyLidl13oxQ73jrxV88dA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=ust.hk; dmarc=pass action=none header.from=ust.hk; dkim=pass
 header.d=ust.hk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ust.hk; s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=XWlBs6nHF4bbgSsIGbncIRe7MbtENRoWDQWDVECFKkM=;
 b=auuMXpYfi88baCPw5/hoIx879LP9OvJROfP2OLKmbNuJP+LKphJFHVJr1btro/GfgNwzVkc90Ieo1HTce6j+VSiCDAJSJbIH4t7STitPdu94FlAekYx8Ls3izhlB8JQZs3wQql3O56dDUBL+nxxJsLxxb2Cp+OJqo4RNPRgm51tuiFWGTOrFymYTk2e1DhQOFKPaCjgzko2lsp6ZI3f1sD4/nmF/QgQDSndnbAH138UcGFyQvQNUry66VOepADgZT2gSAgIDiCKTrlhqo6IAhqL1MrsaQ4mwxWmsLJvzru/cKJUwr4HPBwKwx3FknnwEKpMTrlC2stYPIcqJzLZ5hQ==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=ust.hk;
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:1bf::11)
 by TYWP286MB2037.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:162::14)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Sat, 1 Jul
 2023 00:15:28 +0000
Received: from OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72]) by OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 ([fe80::f9dd:5f78:1a2e:5b72%6]) with mapi id 15.20.6544.024; Sat, 1 Jul 2023
 00:15:28 +0000
From: Andrew Cohen <acohen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; buffer narrowing slowdown regression in emacs 29
X-Debbugs-Package: emacs,gnus
Date: Sat, 01 Jul 2023 08:15:25 +0800
Message-ID: <877crkcwrm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: multipart/mixed; boundary="=-=-="
X-ClientProxiedBy: PS2PR03CA0016.apcprd03.prod.outlook.com
 (2603:1096:300:5b::28) To OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:1bf::11)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: OS3P286MB1877:EE_|TYWP286MB2037:EE_
X-MS-Office365-Filtering-Correlation-Id: cb94249f-8a94-4904-6896-08db79c84613
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: MbqAgZDYoaBX3kMe9B71apd39BFnuq8+5b9yLJ8Wou/6hoAANdYG44dBZhcufc941uLimE4ZhWmZotg2cG+LbDofpopw8c4mknAYvPDeTN5+hp4NiJX9xl2pETNpI6VufhdD06fuNhjQwHTEZisAgU23K3etukfxMg44ba/B4NSDF2CDjSef/m2CFE3970qvqNojT9iFSe/7AYwkoeQrR82YQ0k8FiCr4Zl5WHQCjo5shY5mAK47YzqhXac9VoCSdqDQu3x+m+8G6uYGssal8tL343EbE7DXDZ41w3eacTnVV5PEftNre9gh6jtX4Ls5g8fET7Zslc9mDG4qlwv0dI7nCh3GjtEl/2HRH8jlXaJpcMbIHmifWizCDeirahonbeOKOTebOnezUUawCVe2HsRQyfAJr9RR/p1xUpDpUO+oqtH5Wg3my4i7HQqqyEdVLmo8oRRjrRkCWleCmUtZ7UzUSDjsw14lIERf5NSMDnTUPJoDq1Mdu0KEIoYRc8mvVDCoVfHCa6TXz7/NAdIWNkLI4n3fVVKemxcqw1TnsMlKMx7errzGTRR8e4lTz1is
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(13230028)(4636009)(376002)(346002)(39860400002)(366004)(396003)(136003)(451199021)(2616005)(38100700002)(6666004)(86362001)(6512007)(2906002)(786003)(316002)(6486002)(33964004)(36756003)(66556008)(66476007)(66946007)(4326008)(6916009)(478600001)(186003)(6506007)(83380400001)(41300700001)(5660300002)(8936002)(8676002)(235185007)(26005)(66574015);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bjJtY3BXUTN4eWNpb09ObW40S25Obkp5WUNJRjgyL3hKUG82clFPUzNQR1Bm?=
 =?utf-8?B?M2Q1M3hLWnUzbUxsMjJPQk8vU2Y0VWNsckl5NHlJTUhvd0JRekk5SG1UQXkr?=
 =?utf-8?B?VE9iTHNNWE1rdnZHcVZLdXNiN2FJNUo2RE1FM1NIOGlNYlE3SXZqbTBLNkdZ?=
 =?utf-8?B?SnplVjRpWlViTDNFR1I0MzB0NGs0T0NtVVRPQjdUdHV2QTZBMmRyTnNNQTJi?=
 =?utf-8?B?anlkOEJibVVVNGcyZjl1c1dYd1lraWtCOXNCR1RDUFd1Vmpab2tQeXdkdUhn?=
 =?utf-8?B?eGVscm1hLzdGTFA5WFE4aHFaOWZOTEtQbU9qUldLUDZkMjRTZy9SNVNlWUpo?=
 =?utf-8?B?WDRoMVdqRG9kMnptQys2VnZmZkVibld5ajNuM29BN3RvR0VZVndCcVJXZjFs?=
 =?utf-8?B?a3RvdmZuYWV3bVB3VkVSay9TWHg2N3hoSEliNytEWGV3MjVXTTZZN2s3TUxG?=
 =?utf-8?B?cDY1ZERQQUlMdkVQazYwYmEvckUybHRFQk5TdndXMlNtWHNSSjNKMzh3V3BG?=
 =?utf-8?B?QUg3eURSbW1XZFExQUlHMlFpVWxNWldTSmgxZUprTURFeUZObHR1Y1hyQ0pk?=
 =?utf-8?B?ZkczSlZaN3hZaWg2MnRJalF1WU5MdElBOWVOMWYwRGFPeTVUc0ZRSFFBeEhw?=
 =?utf-8?B?Z2ZxaVpvd0pDc0JEUWkrZC91Q0NQZjcxejRuR3NLU1J5eWQzK3M5eS9lL2xp?=
 =?utf-8?B?d042OE4wUkdMN3NPbmhoMXhVOFMySkN0N0w4NG5QRk02V0pYSDdPSERaUjhT?=
 =?utf-8?B?aGJNY1FqU2QzQ3VLNE1iZnNWZFBXRlk3OEMvOHlLTzc0L3JWUzNxTjRUdjR2?=
 =?utf-8?B?OUhtYkg1ZHNHMUlsVUwxRXFBVXM2SmdtcFNUWDJ1ZG1kWFFLMW43QXZKbDJU?=
 =?utf-8?B?MFBSSUl0bjBxZ0VYKzEyZFRJdU9zSHhvRnNyUG0yYnpTVFBSVXZWeDE0ekRN?=
 =?utf-8?B?aXMrbUQrNnZKb0tONXBuQjE3TlBvNkl2QnNHSmZrNExhMVhQSWhuSmx6UEhm?=
 =?utf-8?B?Uk1HbU9LcEVJb0pBQ090K0lucU5wcUdLQVo0QVhMQWJoMHFjUXk1SHZ6U0Ir?=
 =?utf-8?B?R2pGNG9tTVFiRTE0UkxwZlhDdm03ZEdhM3pLVXhqZS9YZTM1d1ZRZmhQcjBX?=
 =?utf-8?B?Tko4cWxqUDFDbFJSSmo1T3pLcmxieGc1SU96d1VKcVFhOEFaNktsVkV3a3Nk?=
 =?utf-8?B?eGZsd0hTVnV6aFhNZkhFeGdjNjFwcVFxWmtsQ2dzbVRtL1RBTzBuRkQ2c1pn?=
 =?utf-8?B?SThpWEpTdWU0MGpiNC9KNm5IcWJlVFRMN0FqcWZmY0dxVUJPTTN4Z243UTVh?=
 =?utf-8?B?aXBIbndQaVd0eWppMG96U21HanlhSnBma2QwdWZiOGRXc1VIamF1alYraEJ5?=
 =?utf-8?B?OVV3UWJmYVNNeE1zRkx6aXlvOHI4MzREdHprUTc5NHQzbHhoMHBsOVpZOHpL?=
 =?utf-8?B?aDgxM3VxTHQ1ejN1QVhtU245QVFlTklPMnhobkFXNTl5SnJDRVRaSjFudGpt?=
 =?utf-8?B?UjBZcWpPd1VKZ0M0Wmt2Wmw0bUJIR3d6RkpSR243ckZRM3QzbytBWVYvSVVy?=
 =?utf-8?B?THpmVSs2bnZvRUxYWWZKd2VsanROR0tjeWx1dXdWYmh2V25MSTRxN0Z0SWxt?=
 =?utf-8?B?Z1FCRW5FVFVCYXIwSS8vcUI0am56S2xhTHFXdTFvMmcySTlKMzI3WUlSNjQz?=
 =?utf-8?B?NmNPaDRxM3NPLzhMaDl0d3lLc1k1RkZncTI5Smx1VFN0T1ljRDhUM08zYnAx?=
 =?utf-8?B?Y3hkVmUxazBMVE96eThmTzZqSnJTdHIzWnFQQ25Ia2J1cUg1R2ZvRkJuek9l?=
 =?utf-8?B?OWFwK3RwU3NXZnhIT25kL3FPQlFkUnE4dlBleGpKYnN2cGFEN29jNnRyQThv?=
 =?utf-8?B?Y1VhTHgzenczVTZ1Y1oxWU1BRWJBREdyR0Q5bmFCRG1xUmtMU0dNODJ4STdh?=
 =?utf-8?B?WGoyN3VjL0ZZMjJ0RGdhNDdSc3JCRWNtbXRqTnFTOUl4WWdUTnR1QU4rNmc0?=
 =?utf-8?B?THlCR0luaG5NSEtvekp0UnlzZjdwV3B4MFFFdklIRjczbytqUEV5REcrc3Jr?=
 =?utf-8?B?VUpkYzFlWnFiQXFYcCtvTTZHaHhJK3NXMEZHTUdhTlA2T3E3K1p2KzY0VTgy?=
 =?utf-8?Q?sXRze23rZ5sm+Y7eM3oCE497t?=
X-OriginatorOrg: ust.hk
X-MS-Exchange-CrossTenant-Network-Message-Id: cb94249f-8a94-4904-6896-08db79c84613
X-MS-Exchange-CrossTenant-AuthSource: OS3P286MB1877.JPNP286.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 00:15:28.2154 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: c917f3e2-9322-4926-9bb3-daca730413ca
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 1npYbivs82lmOS58TSJmzOKybSyYaUbn8Nj6g5tRM5Oy3xiy3ZznfHGrXSnbMdJf
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWP286MB2037
Received-SPF: pass client-ip=2a01:111:f403:7010::718;
 envelope-from=acohen@HIDDEN;
 helo=JPN01-TYC-obe.outbound.protection.outlook.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Gregory Heytings <gregory@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


I have noticed a huge slowdown in parsing email headers in gnus. After
some debugging with help from Mattias Engdeg=C3=A5rd, the problem has been
traced to the narrowing code introduced in

commit ba9315b1641b483f2bf843c38dcdba0cd1643a55 (HEAD)
Merge: aef803d6c3d a3b654e069e
Author: Gregory Heytings <gregory@HIDDEN>
Date:   Thu Nov 24 14:21:30 2022 +0100

    Merge master into feature/improved-locked-narrowing.

Gnus populates a buffer with headers from a set of email messages and
then parses them by: narrowing the buffer to the headers for an
individual message; parsing the headers; widening; and then repeating
for the next message.  As part of the parsing the headers are "unfolded"
so that each header doesn't include line breaks. I noticed that for a
long list of messages (10,000) this takes between one and two orders of
magnitude more time in Emacs 30 than in Emacs 28. Unfolding all the
headers in the full buffer before the parsing process removes most of
the slowdown. The slowdown seems to grow quadratically with the size of
the buffer.

The problem seems fairly general and Mattias has produced a simple test
case to demonstrate the issue (code at the end of this message):

1. Create a buffer with 100,000 lines each containing two characters  "ab".
2. Loop through the buffer narrowing to each line, and immediately widening
    back to the full buffer (so no change is made to the buffer
    contents).
3.  Loop through the buffer removing the first character of each line.

This takes a very long time compared with reversing the order of 2. and 3.

Emacs 28.2
Modify after narrowing:  0.173 s elapsed, 0 GCs, 0.000 s GC, 0.173 s non-GC
Modify before narrowing: 0.160 s elapsed, 0 GCs, 0.000 s GC, 0.160 s non-GC

Emacs 29.0.92
Modify after narrowing:  4.454 s elapsed, 9 GCs, 0.115 s GC, 4.339 s non-GC
Modify before narrowing: 0.291 s elapsed, 9 GCs, 0.114 s GC, 0.177 s non-GC

The problem may be the creation of markers in the narrowing process that
slows down further mutation. (Also note that the new code has introduced
some significant GC that was previously absent).


--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: attachment; filename=abench2.el
Content-Transfer-Encoding: quoted-printable
Content-Description: Demonstrate narrowing slowdown

;;; -*- lexical-binding: t -*-

(require 'cl-lib)

(defconst abench-lines 100000)

(defun abench-run (modify-before)
  (let ((buffer-undo-list t))
    (when modify-before
      ;; Modify all lines in one sweep without narrowing
      (goto-char (point-min))
      (while (not (eobp))
        (delete-char 1)
        (forward-line)))

    ;; Narrow around each line but do not modify
    (goto-char (point-min))
    (while (not (eobp))
      (narrow-to-region (point) (line-end-position))
      (widen)
      (forward-line))

    (unless modify-before
      ;; Modify all lines in one sweep without narrowing
      (goto-char (point-min))
      (while (not (eobp))
        (delete-char 1)
        (forward-line)))))

(defun abench (modify-before)
  (with-temp-buffer
    ;; Populate buffer
    (insert (mapconcat #'identity (make-list abench-lines "ab\n") nil))
    ;; Run operation
    (garbage-collect)
    (let ((gcs0 gcs-done)
          (gc-e0 gc-elapsed)
          (t0 (float-time)))
      (abench-run modify-before)
      (let ((dt (- (float-time) t0))
            (gcs (- gcs-done gcs0))
            (gc-time (- gc-elapsed gc-e0)))
        (cl-assert
         (equal (buffer-string)
                (mapconcat #'identity (make-list abench-lines "b\n") nil)))
        (format "%.3f s elapsed, %d GCs, %.3f s GC, %.3f s non-GC\n"
                dt gcs gc-time (- dt gc-time))))))

(princ (format "Emacs %s\n" emacs-version))
(princ "Modify after narrowing:  ")
(princ (abench nil))
(princ "Modify before narrowing: ")
(princ (abench t))

--=-=-=
Content-Type: text/plain




-- 
Andrew Cohen

--=-=-=--




Acknowledgement sent to Andrew Cohen <acohen@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN, bugs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#64391; Package emacs,gnus. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 7 Jul 2023 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.