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#56682: Fix the long lines font locking related slowdowns Date: Sun, 31 Jul 2022 22:54:00 +0000 Message-ID: <8c7321f2f39b7a28dd18@heytings.org> References: <837d40ds09.fsf@gnu.org> <83zggwcby5.fsf@gnu.org> <83o7xccagi.fsf@gnu.org> <831qu7daxb.fsf@gnu.org> <83sfmnb7yg.fsf@gnu.org> <837d3ybh5z.fsf@gnu.org> <136c4fe0fc74196714aa@heytings.org> <83pmhp89ov.fsf@gnu.org> <136c4fe0fc39573addc9@heytings.org> <83k07x8738.fsf@gnu.org> <136c4fe0fcdf00ef9a11@heytings.org> <83h73183r7.fsf@gnu.org> <136c4fe0fc0fceb0d752@heytings.org> <838roc8ka7.fsf@gnu.org> <83tu706obt.fsf@gnu.org> <83h7306ifa.fsf@gnu.org> <83edy37pul.fsf@gnu.org> <83pmhn55sk.fsf@gnu.org> <65cb7c73fdc753518d35@heytings.org> <83fsii68o3.fsf@gnu.org> <65cb7c73fdf6704d19d5@heytings.org> <835yje62vz.fsf@gnu.org> <83r1214uz5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1762"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 01 00:55:09 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIHq1-0000Gj-1O for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 00:55:09 +0200 Original-Received: from localhost ([::1]:33402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIHpz-00012t-Su for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 18:55:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIHpu-00012l-03 for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIHpt-00045V-Nm for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:55:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIHpt-00089p-IC for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 18:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 22:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165930804331285 (code B ref 56682); Sun, 31 Jul 2022 22:55:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 22:54:03 +0000 Original-Received: from localhost ([127.0.0.1]:38791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIHox-00088X-Aq for submit@debbugs.gnu.org; Sun, 31 Jul 2022 18:54:03 -0400 Original-Received: from heytings.org ([95.142.160.155]:32890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIHov-00088E-NF for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 18:54:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659308041; bh=y9QuOL+iSZ44YGw/3bviWh/UkqmA8S3HsZqMjKKR3S4=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=NhgaqnsZoF0QxMj/BU1zR8G0mYBoHgaqnBO63xMfJR8vZgRqSBhT7aN925+bV5uM2 BT4RMNfw+YhuWMLygpPcdtDMSAKND/JuqO8DIAreU60PkRSL3w5qv6rLpLIPOf+/DP smQiI04hJOb1MJpMYT6fTyG9rgEB/j8KFIq9mYyjm0OwQpzT9ruFarleBqT6hZgBKn B31hUPfslqqrFlQRaKPWNm96OQ6Vk6kR9WkKwaQZQ6zL7MaW/Yxsj3ZkdZTHrep56f xLxWJGaYyYzo45INH5AE/MTrIvOE2FlyUVzl9gq1wPR11Eb9FbFDQ1kK9DZ/SFXf8b /h86/hngwBtaQ== In-Reply-To: <83r1214uz5.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238376 Archived-At: > > Here are my thoughts. > Thanks! > > First, I think the setting of narrowed_begv and narrowed_zv should be > done in 'reseat', not in init_iterator. The latter always calls the > former when invoked to start iteration of buffer text, but we also call > 'reseat' from other places, when we "jump" the iterator to a new place, > potentially far from the last. If nothing else, this should help with > truncate-lines, where using window_point is basically right only for the > point's line. And currently, init_iterator computes and sets the > narrowing even when we iterate on strings, which is unneeded and > incorrect. > > Whether always to correct narrowed_begv and narrowed_zv if we are > reseating to a position outside the narrowing, is a more complicated > question. The basic problem here is that we don't have an easy way of > restoring the previous narrowing (except by unwind_protect), and the > display code sometimes calls init_iterator or start_display using the > iterator that already has these members set by previous code, a > situation which we currently cannot easily detect. However, when this > code runs as part of redisplay, we generally don't expect the original > narrowing to be insufficient, except perhaps in the truncate-line case. > > So I think we should correct narrowed_begv and narrowed_zv only if > either the 'redisplaying_p' flag is reset (meaning the display code is > being invoked outside of redisplay) or it->line_wrap == TRUNCATE. > I admit I do not really understand your last two paragraphs, but I tried to do what you suggested, and it doesn't seem to introduce regressions, so I pushed it to the new feature branch.