From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Fri, 29 Jul 2022 21:09:38 +0300 Message-ID: <83edy37pul.fsf@gnu.org> References: <174616cd5c33bfc14b1f@heytings.org> <837d44jr4p.fsf@gnu.org> <83bktghrn0.fsf@gnu.org> <8a3eaeef010995a5da8d@heytings.org> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36152"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 29 20:12:31 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 1oHUTP-0009FS-EY for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Jul 2022 20:12:31 +0200 Original-Received: from localhost ([::1]:53126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHUTO-0005OU-CP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Jul 2022 14:12:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHUR3-0003ED-7i for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 14:10:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHUR0-00079P-EK for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 14:10:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oHUR0-0005gd-44 for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 14:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2022 18:10:02 +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.165911817521821 (code B ref 56682); Fri, 29 Jul 2022 18:10:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 29 Jul 2022 18:09:35 +0000 Original-Received: from localhost ([127.0.0.1]:33406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHUQY-0005fs-Hd for submit@debbugs.gnu.org; Fri, 29 Jul 2022 14:09:34 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHUQX-0005fe-0m for 56682@debbugs.gnu.org; Fri, 29 Jul 2022 14:09:33 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHUQQ-00076z-S4; Fri, 29 Jul 2022 14:09:26 -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=wlx6HUWNe+eEMBVvvU8bJcjYO1cD2KTsb3RvIeFhO5k=; b=EAHsCBqlsGHT 2SR5Ai1CLDVanc7Q3ZVxfX7QB5yZROXkblRs+KPeqlNrA1zGlVR6SX0PMayPfilD9mwp03WpXFGW4 nhgnv+tYXOh4n2o93G2UOXMni8BQIQpsMx4tM1l9HKfVbpLP2OKaQMICHWJfysXZB5gT68VAFDy/J 4x9D9QDB7ZcOr5OFbqUlFPs9/aZjzj3RkfL6Aull+WfTcqJKPdshWWRxoHWzg6AnRJQ3cR23ZsauU 7Ek+jaszUSN6AfCouLt07e2j/zMG0qvvGO91WtrlS08RL3pwf/qoTERrpuLTq3k35NvnyUNaBM4by mXQ8HQLQ9ztdE4R9zAdeog==; Original-Received: from [87.69.77.57] (port=1742 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHUQQ-0003ep-74; Fri, 29 Jul 2022 14:09:26 -0400 In-Reply-To: (message from Gregory Heytings on Fri, 29 Jul 2022 16:37:14 +0000) 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:238206 Archived-At: > Date: Fri, 29 Jul 2022 16:37:14 +0000 > From: Gregory Heytings > cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, > monnier@iro.umontreal.ca > > > >> At least if I do (pos-visible-in-window-p (point-max)), they are not: > >> handle_fontified_prop is not even called with it at point-max. Even > >> with (pos-visible-in-window-p (1+ (window-end))) > >> fontification-functions are not called. > > > > Try with vertical-motion. Visit long-line.xml, go to position 20000, > > and then do "C-u 200 C-n" or "M-: (vertical-motion 200) RET. Sooner or > > later you will see that it->current in handle_fontified_prop will be > > outside of the narrowing. > > > > Thanks, I was able to reproduce the bug with that recipe. > > >> Should we perhaps be extra careful and add not apply the narrowing when > >> IT_CHARPOS is not between narrowed_begv and narrowed_zv? > > > > I'd rather narrow around IT_CHARPOS in that case. That would be also > > consistent with what the doc string of fontification-functions now says. > > > > Perhaps we should also change what init_iterator does: if the start > > position with which it's called is outside of the restriction, recompute > > the restriction using the start point instead of the window's point > > position. WDYT? > > > > Doing it in init_iterator is too early alas, with the above recipe at > least init_iterator is called with charpos inside the narrowing bounds, > after which the iterator moves outside the narrowing bounds. So I fixed > the bug in handle_fontified_prop. Thanks. > I don't know yet if it's necessary to add another similar recomputation > inside init_iterator. I'll play with other callers of init_iterator and start_display, and see if they can do similar things.