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: Thu, 04 Aug 2022 16:09:33 +0300 Message-ID: <83r11w2m0i.fsf@gnu.org> References: <837d46mjen.fsf@gnu.org> <8335esjppt.fsf@gnu.org> <837d43j198.fsf@gnu.org> <83y1wjhkkh.fsf@gnu.org> <83wnc3hkdg.fsf@gnu.org> <49df74e5-e16a-a532-98d1-66c6ff1eb6c6@yandex.ru> <83pmhuft5a.fsf@gnu.org> <05388e8d8836c2e7ef3e@heytings.org> <136c4fe0fcb9ce5181cb@heytings.org> <3d639ea12689d767ba2a@heytings.org> <03dce9be-5c51-94d7-a32a-52ab7f57dde2@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16353"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 04 15:37:39 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 1oJb2g-00045c-FB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Aug 2022 15:37:38 +0200 Original-Received: from localhost ([::1]:34788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJb2f-0005Id-8u for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Aug 2022 09:37:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJabz-0007uX-ED for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 09:10:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJabz-0000ub-3L for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 09:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJaby-0000jA-OF for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 09: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: Thu, 04 Aug 2022 13: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.16596185992766 (code B ref 56682); Thu, 04 Aug 2022 13:10:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 4 Aug 2022 13:09:59 +0000 Original-Received: from localhost ([127.0.0.1]:51566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJabu-0000iX-VR for submit@debbugs.gnu.org; Thu, 04 Aug 2022 09:09:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJabg-0000hx-Cl for 56682@debbugs.gnu.org; Thu, 04 Aug 2022 09:09:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJabZ-0000pf-Ge; Thu, 04 Aug 2022 09:09:37 -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=FIWv6ko7gwI+7Yt01tWwnFv5/3MUG3fc68rOXESD9IQ=; b=SpiPXViF+SZkmYaC9cv8 XG/oMvHU9IhVhuOWzwpSfeJMaWOVPN+KrXubr8ehlkA/O8FEZBPn7b/3yDIGh4yQi+mR97KuY25/G WIoPosW7kVqnhCh4bQfySMqmCXIMyQKOGwsgrPnTigPRNbsqkoOZlQ8T1XHvGwWezgehfKlrgg61N ULoxVpUQiI+9WqyDfWMeMG1k0u5mktwKXNGF+J9DuT5WqKYAul2uhyRTxOv1RYGXLl/Bykgn5qsIK BJg1Xj+IdDN4TD7ZLu3B2U34R3Rnb4dkbR17J8lAcwFNSM5M0j9sY8TfC3zOzuK3Cy9yQ5MY5XAPl 4M1mKAT3tSCgug==; Original-Received: from [87.69.77.57] (port=4970 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 1oJabY-0003KK-Vy; Thu, 04 Aug 2022 09:09:37 -0400 In-Reply-To: <03dce9be-5c51-94d7-a32a-52ab7f57dde2@yandex.ru> (message from Dmitry Gutov on Thu, 4 Aug 2022 13:35:39 +0300) 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:238739 Archived-At: > Date: Thu, 4 Aug 2022 13:35:39 +0300 > Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, > Eli Zaretskii , monnier@iro.umontreal.ca > From: Dmitry Gutov > > > It's a tiny file, not in any way representative of the ones we're > > dealing with.  But amusingly, even with that tiny file, you can see the > > problem at hand.  Do M-: (setq long-line-threshold nil) RET, and open it > > in a large enough window (e.g. 160 characters).  Type M->, and try to > > move point there with C-p or C-n.  You'll see that Emacs is already > > sluggish. > > That's the scenario I described, and that's my point: this file's > display is sluggish. Even though font-lock has already finished its > work. And it didn't have to spend any significant time in syntax-ppss. > > So there is a particular performance problem with the display of > fontified buffers which I'd really like your help in fixing. Maybe it is in display, and maybe it isn't. Do you have any evidence that the sluggish response is due to redisplay? C-n, for example, is mostly not redisplay, but Lisp code in simple.el and occasional calls to vertical-motion. But even if the slow response is due to redisplay, we just have another cause that we need to investigate and try fixing. It says nothing about the measures we've already taken on master. They definitely make even this case faster, and with an unoptimized build I can now reasonably edit this file, something I couldn't do before. > Fixing in a way that doesn't add narrowing around > fontification-functions, because as we can see it's not necessary in > examples like this. If that is possible, sure. No one said that from now on every problem in Emacs that causes slow responses will be handled by narrowing. But if, for example, it turns out that the slow responses is due to time it takes some code to traverse a long stretch of fontified buffer, what other solution would you suggest except making the portion to be traversed shorter? > > If you dislike mis-fontification, turn font-lock mode off.  It's as easy > > as that.  Mis-fontification is expected in such cases.  The docstring of > > syntax-wholeline-max also mentions that "misfontification may then > > occur". Why did you not protest at that time? > > I think we could have both speed and correctness, at least for files of > this size. That is not a given, and the experience till now suggests otherwise.