From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#64391: buffer narrowing slowdown regression in emacs 29 Date: Thu, 06 Jul 2023 18:45:50 +0000 Message-ID: <26cee506f77e9c87e325@heytings.org> References: <87r0psb51z.fsf@ust.hk> <0AD15A09-F669-48C0-AF5C-971D52F5BF8E@gmail.com> <83v8f3q1ff.fsf@gnu.org> <50A46AAC-2089-45CB-A355-CCB2B4EA8D76@gmail.com> <5995c9ed6a0b39c3070c@heytings.org> <83a5wak1tr.fsf@gnu.org> <26cee506f708f3c6cfe1@heytings.org> <26cee506f70bbc9de58b@heytings.org> <83h6qghpdc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25873"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acohen@ust.hk, 64391@debbugs.gnu.org, mattias.engdegard@gmail.com, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 06 20:46:30 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qHTzq-0006XN-KL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jul 2023 20:46:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHTzh-0002uj-19; Thu, 06 Jul 2023 14:46:21 -0400 Original-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 ) id 1qHTzO-0002ub-K6 for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2023 14:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHTzO-0001dM-Bu for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2023 14:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qHTzN-0005x7-MM; Thu, 06 Jul 2023 14:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Thu, 06 Jul 2023 18:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64391 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 64391-submit@debbugs.gnu.org id=B64391.168866915422869 (code B ref 64391); Thu, 06 Jul 2023 18:46:01 +0000 Original-Received: (at 64391) by debbugs.gnu.org; 6 Jul 2023 18:45:54 +0000 Original-Received: from localhost ([127.0.0.1]:42049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHTzG-0005wn-Ec for submit@debbugs.gnu.org; Thu, 06 Jul 2023 14:45:54 -0400 Original-Received: from heytings.org ([95.142.160.155]:43534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHTzD-0005wb-G4 for 64391@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== In-Reply-To: <83h6qghpdc.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264691 Archived-At: >> 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.)