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: Sat, 23 Jul 2022 09:10:46 +0300 Message-ID: <837d44jr4p.fsf@gnu.org> References: <837d46mjen.fsf@gnu.org> <174616cd5c33bfc14b1f@heytings.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Stefan Monnier To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 23 08:15:28 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 1oF8QB-0006iY-VK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Jul 2022 08:15:28 +0200 Original-Received: from localhost ([::1]:48208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oF8QA-0005gL-Fc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Jul 2022 02:15:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oF8Ms-0004AJ-U3 for bug-gnu-emacs@gnu.org; Sat, 23 Jul 2022 02:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oF8Ms-0001OI-Kr for bug-gnu-emacs@gnu.org; Sat, 23 Jul 2022 02:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oF8Ms-0002li-E0 for bug-gnu-emacs@gnu.org; Sat, 23 Jul 2022 02:12: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: Sat, 23 Jul 2022 06:12: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.165855666210554 (code B ref 56682); Sat, 23 Jul 2022 06:12:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 23 Jul 2022 06:11:02 +0000 Original-Received: from localhost ([127.0.0.1]:42976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF8Lu-0002kA-GK for submit@debbugs.gnu.org; Sat, 23 Jul 2022 02:11:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF8Lp-0002jb-4R for 56682@debbugs.gnu.org; Sat, 23 Jul 2022 02:11:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oF8Lj-0001Io-6H; Sat, 23 Jul 2022 02:10:51 -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=YB+V0U3+Ih1l100YAu++IfLE6Y9YZ+ItYEJQxWBW0Ms=; b=F77/LT9VV/SP 5o1qLC+gIpdTLL7RqgOOjHMizKmg4h/v/rATRZ0wuSl53c3x2YGbrm1rQxstjrxMg+nrAsb/MrjZq G49KSuMIjqopg1pX3jm0LjxNY98+pkTH9hyNQ/3ImusJy9SJjAJ68sYrwN4dO5E6WDIzNBMRHiZo2 fZbMnhD7GVYb/8L1O/oI0eyGhKhIsoUgiIPJTWufdeF8PKmnzPNOEiKbMPIf2SpnLiz6Rf0IsORnj en4zhnJoGzh+Mr2Ai0D9y+ptQkdcEYdAQgkWE6fB/4j/SM9ATNihvU4O6e9HA8GP0XJcFcZf9S2N6 ic46gtFs3gFX1Q6vhvo2vA==; Original-Received: from [87.69.77.57] (port=2096 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 1oF8Lg-0001Z7-JV; Sat, 23 Jul 2022 02:10:51 -0400 In-Reply-To: <174616cd5c33bfc14b1f@heytings.org> (message from Gregory Heytings on Fri, 22 Jul 2022 10:16:52 +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:237670 Archived-At: > Date: Fri, 22 Jul 2022 10:16:52 +0000 > From: Gregory Heytings > cc: Eli Zaretskii > > on my laptop, with Emacs from master from a week ago, take respectively > 150 seconds and 40 seconds. With the improvements on master, 1 is > instantaneous but 2 still takes about 5 seconds. Now, with the changes in > the feature/long-lines-and-font-locking branch, both are instantaneous. > The price of that speedup is that some portions of the buffer will be > mis-highlighted, which is unavoidable. The branch is much faster, indeed, but still font-lock imposes a significant penalty on commands that needs to redisplay. For example, running the following simple benchmark: (defun scroll-up-benchmark () (interactive) (let ((oldgc gcs-done) (oldtime (float-time))) (condition-case nil (while t (scroll-up) (redisplay)) (error (message "GCs: %d Elapsed time: %f seconds" (- gcs-done oldgc) (- (float-time) oldtime)))))) on long-line.xml produces a 15-fold slowdown with font-lock turned on as compared to its being turned off (203 sec vs 13 sec). This is an unoptimized build, so you will probably see times that are 4 times faster, but I'd be interested in the relative times on your system. Any explanations of the slowdown are also welcome.