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 21:23:55 +0000 Message-ID: <8a3eaeef01be5bfaa5ef@heytings.org> References: <837d46mjen.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="20766"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 25 23:24:58 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 1oG5ZR-0005AA-TI for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jul 2022 23:24:58 +0200 Original-Received: from localhost ([::1]:55082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG5ZO-00074i-SR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Jul 2022 17:24:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG5Yb-00074C-31 for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 17:24:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG5YX-00084X-UX for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 17:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oG5YX-0005Ck-KC for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2022 17:24:01 -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 21:24: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.165878423919998 (code B ref 56682); Mon, 25 Jul 2022 21:24:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 25 Jul 2022 21:23:59 +0000 Original-Received: from localhost ([127.0.0.1]:51571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG5YU-0005CT-V7 for submit@debbugs.gnu.org; Mon, 25 Jul 2022 17:23:59 -0400 Original-Received: from heytings.org ([95.142.160.155]:52600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG5YT-0005CK-4T for 56682@debbugs.gnu.org; Mon, 25 Jul 2022 17:23:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1658784235; bh=FdOmtIt+YPhsR811gh8BytyumLZ0Oy13fm/+51riGG4=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=SCD3QN/oxVXuGNAn6RI1VndFeqJ+iV/FYYhDyHkJYNCIhi2HTvLbFSdIa+mro9bQm ULO95jcz52ljfkh6Knamf+repYei+mVm6oxgZifLt1hRj9gIy7aSYB6Wr14bqk4nlv E2lnI7fSNZBOQew3ji00P4cFwy/YCTLt5kqww14G5V/co6xbsBFvNCraVStcDSUZSW 4WoQLYJPGKXLHWGO7RKddufFuSoL+3unwhvzofRGoCiSsuFJlA85EIqctfxNCI3oeE cM1634Vkl4YrU8Z/SZS02jc7xjG+d69Zy3guQZAPNf/kRObyrnKL1FAsNdkxj46OmA Hp32nggLUr13Q== 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:237908 Archived-At: > > 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. Think of it as POSIX's ulimits. 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. 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. (Note that at the moment that tool is enabled only when files with long lines are visited.)