From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Tue, 26 Jul 2022 17:17:29 -0400 Message-ID: References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24056"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 26 23:18:26 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 1oGRwf-000608-Hd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Jul 2022 23:18:25 +0200 Original-Received: from localhost ([::1]:49150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGRwe-0006DZ-GO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Jul 2022 17:18:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGRwI-0006DO-7x for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 17:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGRwH-00040Y-VH for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 17:18:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGRwH-000811-QQ for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2022 17:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Jul 2022 21:18: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.165887026730786 (code B ref 56682); Tue, 26 Jul 2022 21:18:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 26 Jul 2022 21:17:47 +0000 Original-Received: from localhost ([127.0.0.1]:54515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGRw2-00080R-Jv for submit@debbugs.gnu.org; Tue, 26 Jul 2022 17:17:47 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGRvu-000803-Ti for 56682@debbugs.gnu.org; Tue, 26 Jul 2022 17:17:45 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7EE4B80783; Tue, 26 Jul 2022 17:17:33 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F23D58007C; Tue, 26 Jul 2022 17:17:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1658870251; bh=DoQ9RNrSOfloWY91MnWVPaxwA0Lywtan4oQBeZrXmhg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=c3kbIsiKob6v409/f8qbApFir8VlsbZyap2ePXEoAEZB9uDgN9cSxukUccfcBXyTA W/zzJMzMy5uqXv3dRmRgrmuGbOroeKoOmCbEL+KZDImBW/GuoCfUS4TB9hbZX9GSh0 kuFauSSLrr+ZcM11unt4xCfWfMZJ3jonG+eKY+jAfCCaPRFhqAcXjNilQugKkqzzKm NGvQaGKBoxWi7vQTU4rKcnitpcnwcIPGsOWGh7DI55q+oPFDLlNdX6cIMg6V8RoqxG FPi8f2072CQuUGQYJMT3/HMIVrUASPmWBkmSF77deqV0iCnkV0mw/LNfXuKHY0m5UH 0HVOccGcldKgQ== Original-Received: from milanesa (dyn.144-85-168-031.dsl.vtx.ch [144.85.168.31]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2B88112025D; Tue, 26 Jul 2022 17:17:31 -0400 (EDT) In-Reply-To: <8a3eaeef01be5bfaa5ef@heytings.org> (Gregory Heytings's message of "Mon, 25 Jul 2022 21:23:55 +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:237991 Archived-At: Gregory Heytings [2022-07-25 21:23:55] wrote: >> Before using a blunt tool like the forced-narrowing now in >> `feature/long-lines-and-font-locking`, I think we should try and figure >> out *why* the recipe below is so slow. > It's not a blunt tool, it's an appropriate tool to help making sure that > Emacs remains responsive when large files are visited. I'm not opposed to reducing the size of the text that's considered, but doing it via narrowing is a blunt tool. > Think of it as POSIX's ulimits. That's also a blunt tool. > Allowing fontification-functions to search for arbitrarily complex > regexpes in an arbitrarily large buffer, each and every time they are > asked to to highlight a small chunk of the said buffer, is a recipe > for disaster. `font-lock.el` could enforce a smaller scope in a more discerning way that narrowing can. > If for some reason modes really need to go through to the whole > buffer to decide which highlighting to use, they should to do so outside of > fontification-functions, and ideally once, for example, when the file > is loaded. With the current narrowing they can't even know why the buffer is narrowed and hence can't make an informed decision whether they should maybe widen to look elsewhere. Stefan