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: Tue, 26 Jul 2022 14:45:58 +0300 Message-ID: <834jz4drm1.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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34156"; 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 Tue Jul 26 13:47:42 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 1oGJ2L-0008ip-Bv for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Jul 2022 13:47:41 +0200 Original-Received: from localhost ([::1]:58266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGJ2K-0000m3-BX for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Jul 2022 07:47:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGJ1j-0000ja-2k for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 07:47:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGJ1i-0001LG-8Z for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 07:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGJ1h-0008CV-WE for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 07:47: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: Tue, 26 Jul 2022 11:47: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.165883596231432 (code B ref 56682); Tue, 26 Jul 2022 11:47:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 26 Jul 2022 11:46:02 +0000 Original-Received: from localhost ([127.0.0.1]:52412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGJ0k-0008Ak-0I for submit@debbugs.gnu.org; Tue, 26 Jul 2022 07:46:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGJ0i-0008AM-EA for 56682@debbugs.gnu.org; Tue, 26 Jul 2022 07:46:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36722) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGJ0d-00018r-1E; Tue, 26 Jul 2022 07:45:55 -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=yhbL9R5gTuGtcRZKFEli/MEEJJaEN6lKmxE94S0edA0=; b=Z6tUfl3mPBlk l8v64NPuZAlLnpTBZrlh8SHPO4sJwGDSg+SkcR3XHOfbYbPiQoRLDCXJDRgQR4KI5TYenMxSwwuJF i4dpcFM+esYGmQkhNl0V54vph7D5IaSDEGZhUuqcTm/YMitNlDCY/5BPpZ9C+FlrOlfu+BQWD1rNz c4rF+4otM4qyC04KBxbQrVykgFZyblQ31eRY+7tzXcq6VC2Rcxhkyumis2CBfnlNxdF3oymG6cc4r BJRLw4L5onPJxHtverNzlA6cIJLjTGRmtYdhsp/NHYk0SFoGDU9Li5kAkBpC4Ym3J2l7aRq1Lgor5 htJa/r6XxjIfcyoZoryaPQ==; Original-Received: from [87.69.77.57] (port=2872 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 1oGJ0c-0004Kf-79; Tue, 26 Jul 2022 07:45:54 -0400 In-Reply-To: (message from Dmitry Gutov on Tue, 26 Jul 2022 02:23:42 +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:237939 Archived-At: > Date: Tue, 26 Jul 2022 02:23:42 +0300 > Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, gregory@heytings.org, > monnier@iro.umontreal.ca > From: Dmitry Gutov > > >> But the problem is contingent on having long lines, isn't it? > > > > Not necessarily, see the times I measured scrolling through xdisp.c, > > which I posted earlier. It could be that with long lines font-lock > > just makes it slower still, to the point where it becomes unbearable. > > Why with long lines, though? Because they are long. So there's more faces to encounter when going from one line to another. > >> There must be some interplay between those circumstances. Not just > >> having to look up faces (relatively) a lot. > > > > What else did you have in mind? > > Some operation dependent on the length of the current line? > > With font-lock, it seems to get progressively slower the farther you get > along the current (long line). > > E.g. you can have a long line spanning several screenfuls without line > breaks. When the window is scrolled to the beginning, redisplay is > relatively fast (I can press up/down arrows, and they seem responsive). > > But if I scroll the window to the end of said long line, up/down > commands become much less responsive. > > Tested that with today's master and js-mode visiting a minified JS file. > > Perhaps it's due to font-lock logic in that it has to match from the > beginning of a line (not sure we'd want to abandon that promise, > though). Or maybe something else. It isn't font-lock, at least not in all major modes. It's the display engine itself that sometimes needs to go to the beginning of the line. When it does, going back gets slower with font-lock than without. This is why you see slower redisplay when you go deeper into a long line.