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: Mon, 25 Jul 2022 20:49:14 +0000 Message-ID: <8a3eaeef01c9f9aae182@heytings.org> References: <837d46mjen.fsf@gnu.org> <174616cd5c33bfc14b1f@heytings.org> <837d44jr4p.fsf@gnu.org> <83bktghrn0.fsf@gnu.org> <87v8rnc2wp.fsf@gmail.com> <8335erizqh.fsf@gnu.org> <83r12bhgfo.fsf@gnu.org> <83pmhvhg7g.fsf@gnu.org> <83o7xfhfqw.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="14716"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gerd =?UTF-8?Q?M=C3=B6llmann?= , 56682@debbugs.gnu.org, Stefan Monnier , visuweshm@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 25 22:50:57 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 1oG52W-0003Wy-7t for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jul 2022 22:50:56 +0200 Original-Received: from localhost ([::1]:34694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG52U-0008VN-Nv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jul 2022 16:50:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG51e-0008Ul-Lv for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 16:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG51e-00031f-D5 for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 16:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oG51e-00047J-9O for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 16:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jul 2022 20:50: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.165878215815718 (code B ref 56682); Mon, 25 Jul 2022 20:50:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 25 Jul 2022 20:49:18 +0000 Original-Received: from localhost ([127.0.0.1]:51530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG50w-00045S-Bk for submit@debbugs.gnu.org; Mon, 25 Jul 2022 16:49:18 -0400 Original-Received: from heytings.org ([95.142.160.155]:52528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG50u-00045H-7l for 56682@debbugs.gnu.org; Mon, 25 Jul 2022 16:49:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1658782154; bh=UJf4VdDryx0qztLLnDFb5jHUVSmYYltQQW3WsA6HFUU=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=V2JfEu1CvYFCnYha/AeauKq1MabrmaiVcfsfCKWWEErv4EdhoJlAjR5ViC6XonBpn pR0s/eYVAf2vX2qW8nUfrOV9kQRbyFsjuB92pCtPJsvygX8+pjpcQgjEA+1ODax9jV +wlOvkEHBdu7tOlE8WVbY2EIsrQo1IFd/6fu7qOOmvEIIV7eINZRUVUFC3NKEogCat CwGuBKEIIbv/z6slCjNy6WPstHWkaMzgqiaWg3jzQgis8yf9rezf/dwAJLss3ddR0R 8IZIaK3OtAi2BwK+OEGynrmVOryzGI+Th9WWIhpo1BHBNNW6SFkUSajD4Ctdq+7x/B r8dYpmPH/rjVA== In-Reply-To: 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:237906 Archived-At: I pushed another improvement to the branch. Now motion in a font-locked buffer is almost as fast as in a non font-locked one; I don't think it's possible to make further significant improvements. It turns out that the motion slowdowns in font locked-buffers were caused only indirectly by font locking. What happens is that in a font-locked buffer, get_next_display_element calls next_element_from_buffer which uses handle_stop (and therefore compute_stop_pos) to position the iterator on the next element. In a file such as long-line.xml, there are many more stop positions when the buffer is font locked, roughly 100 times more. The solution is to make back_to_previous_visible_line_start do something closer to what it promises, namely "Set IT's current position to the previous visible line start." Previously it moved IT to the beginning of the (temporarily narrowed) buffer, which was already much better than moving it to the beginning of the line, but not enough to make motion commands fast.