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: Mon, 15 Aug 2022 18:52:41 +0300 Message-ID: <395454dd-7238-c5d0-e924-2f65a186baa7@yandex.ru> References: <834jyq29o1.fsf@gnu.org> <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> <12348081660379417@sas2-a098efd00d24.qloud-c.yandex.net> <66bbbb95983414e79637@heytings.org> <83wnb9hadb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29775"; 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 Mon Aug 15 17:56:25 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 1oNcS0-0007ZH-N1 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 17:56:24 +0200 Original-Received: from localhost ([::1]:56550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNcRz-0000pZ-Mk for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 11:56:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNcOk-0006pu-4d for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 11:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNcOj-0001Dw-Rv for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 11:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNcOj-0007g3-Me for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2022 11:53: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: Mon, 15 Aug 2022 15:53: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.166057877129481 (code B ref 56682); Mon, 15 Aug 2022 15:53:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 15 Aug 2022 15:52:51 +0000 Original-Received: from localhost ([127.0.0.1]:43906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNcOZ-0007fR-2K for submit@debbugs.gnu.org; Mon, 15 Aug 2022 11:52:51 -0400 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:35389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNcOX-0007fD-BM for 56682@debbugs.gnu.org; Mon, 15 Aug 2022 11:52:49 -0400 Original-Received: by mail-wm1-f48.google.com with SMTP id m17-20020a7bce11000000b003a5bedec07bso6211525wmc.0 for <56682@debbugs.gnu.org>; Mon, 15 Aug 2022 08:52:49 -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=dqG4WM2wx8b7zYZFc67yYkPz7hwOGjCVdejVwW+G6F0=; b=MKLH+XNX9tdnrTjTrgFHdH50K/ezj2FG+oFC8d+OihXJPGqHA8M+X5frIyHFUl06AF wJ9KYLssdp6n1nUVGiklL+6ziSQLIQq50gyhEMEFmbjvCxEOw+H/9TKqKuU5WWtvwqD4 KBsG4pRYJhD4PkrKug05cZXT48Ie+2OEFSNHBdRbg+lKk+sOw5D5R3yWejGUA5DqPdHv wgUugJT8SmC4duMlMNhK8R0NwQ0rxyz2+jmSXLjw3aTIeo40Ty6elVN6J4y1uqxHFWTH 5HCBY3mBYaioDCdOMYbi8I+0p8ME6bfjipnd48Nx1kmWEFwG6ZAShfEh8KkQXA31rqJq /eog== 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=dqG4WM2wx8b7zYZFc67yYkPz7hwOGjCVdejVwW+G6F0=; b=shgmm4F/QoX3uksWJOoQqEyNBQEbFxH1MB+0maLcmXpRJE7tWWdnsnhSpvNkDr+LD4 1vf3pnE4fESb6wLW9HqLcekTUludAVTG/BwDddrhgxhsPELS+/M3+j3sLtqhYKLEpLdx zpW1ODI0XRXdnjxI81deYQqNHwAkBmo/eI8pVCo+P9VrzptIm9bmAuVHgzuyIY1g2jQt DdYNX0sJRiDzpniv3UN+VunvU9KW1Z8E9jPm8AbwnHlXeKpDt59IqiEBQ+7K55Dtu/EE PSTi+EzS82QTrM03YZqOjau4Z98AOHxxjq9moc/88YBbelmMTwV7Cf6aPmYPvQVkR5cV COJg== X-Gm-Message-State: ACgBeo0NS6fXchVOeaIdZgzLW7apR33af8/nI9h3RXOVC3wI8ZVIm+83 sODiwuezWFcPQxz+Ue4fHD0= X-Google-Smtp-Source: AA6agR6nMMuLdUhSNMpZxcnve+veeePIJ0YlL54QY+CgTEONVXe1SE09xHGHjC15Kegq5o2rA18eIg== X-Received: by 2002:a05:600c:1d14:b0:3a5:e8ba:f394 with SMTP id l20-20020a05600c1d1400b003a5e8baf394mr5209820wms.137.1660578763561; Mon, 15 Aug 2022 08:52:43 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r17-20020a05600c35d100b003a38606385esm16182468wmq.3.2022.08.15.08.52.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 08:52:43 -0700 (PDT) Content-Language: en-US In-Reply-To: <83wnb9hadb.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:239811 Archived-At: On 15.08.2022 17:03, Eli Zaretskii wrote: > I tested this branch with an unoptimized build and a 416MB file made > of 23 copies of dictionary.json, after disabling show-paren-mode. > > Observations: > > . With the default value of font-lock-large-files, which allows > font-lock to widen as it pleases, the initial M-> in takes 5 min > here. That's way too long. On master, this is instantaneous. > . Thereafter jumping into various random places inside the file is > much faster, but still takes between 1 min and 2.25 min -- again > too long, even if I divide by 10 to get an approximation to your > faster machine. On master this takes maybe 1 sec, maybe less. > . Horizontal and vertical motion commands are as fast (or as slow) > as on master, which is not surprising. > > Bottom line: with the default value of font-lock-large-files, this > scales much worse than the master branch -- which again is no > surprise. So we change the default, then? (setq font-lock-large-files '(narrow . 5000)) > My conclusion is that we do need to prevent uncontrolled > widening in fontification-functions, if we want a scalable solution. Do you mean the widening inside font-lock-fontify-region that's controlled by font-lock-dont-widen? > How small or large should the narrowing be is a separate issue. Right. > If we > want to allow a more flexible control of that, we could introduce yet > another variable exposed to Lisp, so that users and perhaps Lisp > programs could tune that, instead of hard-coding the value as we do > now on master. > > I honestly don't see any reason to explore more sophisticated > alternatives for where and how to narrow, until and unless major modes > will on their side develop capabilities which will make such > complications (both in code, but mainly on the user part) justified. I'm pretty sure that doing all that in Lisp is a good thing, and would be conducive to whatever improvements we might want to add later... > If you agree, I'll add on master a variable to control the narrowing > when we call fontification-functions. ...but if you've sure in your decision, okay, please add that additional var which will decide the narrowing bounds for fontification-functions (and whether to narrow at all). That should solve my immediate needs, and I'll try to avoid this subject from now on. Thanks.