From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Sun, 14 Aug 2022 12:54:04 +0300 Message-ID: <0b5e470f-f407-426d-4ebc-53df6b6b488e@yandex.ru> References: <92da07bd028e3ede61a6@heytings.org> <47894c57-dd8b-5778-240a-3fa6540e4d37@yandex.ru> <92da07bd02941d5537e9@heytings.org> <5308e3b5-a160-17d7-77ee-b1d00acfa20d@yandex.ru> <92da07bd02a6cc861e1a@heytings.org> <837d3lzv8n.fsf@gnu.org> <2c8d6755-cfe2-6559-3fde-3fa30ffb411e@yandex.ru> <83mtcgy44k.fsf@gnu.org> <83k07jx5jn.fsf@gnu.org> <866e510d-a060-7daa-d002-97861d056fa7@yandex.ru> <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> <66bbbb9598b42aea3b87@heytings.org> <66bbbb9598e592884ab2@heytings.org> <4d192159-21bc-07f7-7adc-4908303608b0@yandex.ru> <83mtc7l7er.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="330"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 56682@debbugs.gnu.org, gregory@heytings.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 14 11:55:18 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 1oNAL0-000ASd-BT for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 11:55:18 +0200 Original-Received: from localhost ([::1]:46450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNAKz-00008t-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 05:55:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNAKk-00006O-B1 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 05:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNAKk-000486-1q for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 05:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNAKj-0004f0-R5 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 05:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2022 09:55: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.166047085617848 (code B ref 56682); Sun, 14 Aug 2022 09:55:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 14 Aug 2022 09:54:16 +0000 Original-Received: from localhost ([127.0.0.1]:35793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNAJz-0004do-TP for submit@debbugs.gnu.org; Sun, 14 Aug 2022 05:54:16 -0400 Original-Received: from mail-wr1-f46.google.com ([209.85.221.46]:38823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNAJx-0004da-JJ for 56682@debbugs.gnu.org; Sun, 14 Aug 2022 05:54:14 -0400 Original-Received: by mail-wr1-f46.google.com with SMTP id bv3so5920204wrb.5 for <56682@debbugs.gnu.org>; Sun, 14 Aug 2022 02:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=ggtHn0lnyxCL0S48fJd9lJBtEOKuIjA50V4PyJR9PwE=; b=OKbDjXnMW0e58hoJMjmdowxLMQK9i6s4mi0e+ttdK6GTEGCgoM14GgvZCQaiZ3J2lc 0YPM8Uerays9IA8O7lLbQn2m1xcmep00ajxr7Aa5jD02BX2Lb8WCQFfHEtYLRSlDndPL JcxixLTIvvPTR8laMjveqyZZGkvH6o8eHRWd+6yj6UodrbpoNqmmQ80WpOZP8BmPYWSs AkaC3bMQwD0WZmAC9QuvCP/hxmJA8VK/XHyEEI5/m72Uk+PX/FTofa8CYpyEHbMi6VaS hVyZ8DHBkQM+A0E0EHPtkYib462wIR+Miy6T1hTT2wpYP5viRWBSiv5YKVJSjN3jVy1q Hluw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=ggtHn0lnyxCL0S48fJd9lJBtEOKuIjA50V4PyJR9PwE=; b=FoGeUKSPvc+xb1kjmli7RIaKjN2VnlFQHBGyM0NdX1Dn4YSZfVsuRQaBX1hrP2N/u6 Qdm3AWBYCz/oXNw+OcXkuzwYL8RiMpAwUg5mLVAOGJzqxmR0M3IBQdm+4KS9VUAsfEO3 OjdMKifFRs1oUaBlX/RzydxgKqWSwrc+yyPCckSy6Yh9bRimplW34jur3+mPsNYz81M6 5iTHK2PVqcA8lFTEo67Cb6N1UskuA2gQAckDorrNTwDmJRoR0N4FhklRIVZhLusWp+CQ zFZna3cVzuo9HgV3ZIiHk+jxYomYubhK40sl2DIv7Gy6iASq540junUP52WhlftIk1Lk RWCA== X-Gm-Message-State: ACgBeo2QkiKPS+CxIKekf077Tmgfp0eboZUoER+vdrGDvtbrsjcM38Ad pVvruMNyoHAb5qCreewWAeA= X-Google-Smtp-Source: AA6agR4AJ498GvOGR16CJeW2fMNGdUjdvbMYBRk0HeVaaHWnxOZnStpJhmptbtGywA30Hm8JAQ8F4Q== X-Received: by 2002:a5d:64a6:0:b0:21f:b3b:5cc9 with SMTP id m6-20020a5d64a6000000b0021f0b3b5cc9mr5666090wrp.601.1660470846802; Sun, 14 Aug 2022 02:54:06 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bg7-20020a05600c3c8700b003a5c1e916c8sm10833510wmb.1.2022.08.14.02.54.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Aug 2022 02:54:06 -0700 (PDT) Content-Language: en-US In-Reply-To: <83mtc7l7er.fsf@gnu.org> 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:239633 Archived-At: On 14.08.2022 08:29, Eli Zaretskii wrote: >> Date: Sat, 13 Aug 2022 22:12:42 +0300 >> Cc: 56682@debbugs.gnu.org, Eli Zaretskii , >> Stefan Monnier >> From: Dmitry Gutov >> >>> Moreover it does not offer any >>> protection against modes which use widen in their font locking >>> routines.  Which was the main reason to add the locked narrowing feature. >> >> The only modes we know that do that (CC Mode) > > AFAIU, currently _all_ modes widen, because font-lock does. That part > was not yet fixed in font-0lock, was it? The changes on the branch are right in that area: - (unless font-lock-dont-widen (widen)) + (pcase-exhaustive font-lock-large-files + (`t nil) + (`(head . ,length) + (setq beg (min length beg) + end (min length end))) + (`(narrow . ,width) + (narrow-to-region (max (point-min) (* (1- (/ beg width)) width)) + (min (point-max) (* (1+ (/ beg width)) width))) + (setq end (min end (point-max))))) + (unless (or font-lock-dont-widen + (eq (car-safe font-lock-large-files) 'narrow)) + (widen)) >> are also incompatible with your code. Your "protection" breaks it. > > For some value of "breaks". > > And that is a deliberate "breakage": we consider responsive Emacs more > important than correct fontification or "accurate" operation of modes > such as CC Mode. As was already explained numerous times here, and > arguing about that should by now be understood as being futile. > People who disagree with that default can customize > long-line-threshold to a larger value or to a nil value. Due to its current way of operation, it might spam errors to the echo area, break some navigation commands, or even freeze. I imagine it'll be not so easy to rework that. Though I'd of course welcome that: if you recall the older talks about switching it to the syntax-propertize approach, it's one way to do that.