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: Thu, 4 Aug 2022 13:35:39 +0300 Message-ID: <03dce9be-5c51-94d7-a32a-52ab7f57dde2@yandex.ru> References: <837d46mjen.fsf@gnu.org> <8335esjppt.fsf@gnu.org> <837d43j198.fsf@gnu.org> <83y1wjhkkh.fsf@gnu.org> <83wnc3hkdg.fsf@gnu.org> <49df74e5-e16a-a532-98d1-66c6ff1eb6c6@yandex.ru> <83pmhuft5a.fsf@gnu.org> <05388e8d8836c2e7ef3e@heytings.org> <136c4fe0fcb9ce5181cb@heytings.org> <3d639ea12689d767ba2a@heytings.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="7494"; 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: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 04 12:36:32 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 1oJYDO-0001k9-Kc for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Aug 2022 12:36:30 +0200 Original-Received: from localhost ([::1]:42680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJYDN-0001t0-3M for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Aug 2022 06:36:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJYCw-0001sE-GW for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 06:36:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJYCv-00087t-Un for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 06:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJYCv-0000lg-MA for bug-gnu-emacs@gnu.org; Thu, 04 Aug 2022 06:36: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: Thu, 04 Aug 2022 10:36: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.16596093502933 (code B ref 56682); Thu, 04 Aug 2022 10:36:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 4 Aug 2022 10:35:50 +0000 Original-Received: from localhost ([127.0.0.1]:51386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJYCj-0000lF-IH for submit@debbugs.gnu.org; Thu, 04 Aug 2022 06:35:49 -0400 Original-Received: from mail-wr1-f54.google.com ([209.85.221.54]:42603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJYCi-0000l3-BF for 56682@debbugs.gnu.org; Thu, 04 Aug 2022 06:35:48 -0400 Original-Received: by mail-wr1-f54.google.com with SMTP id z12so14631899wrs.9 for <56682@debbugs.gnu.org>; Thu, 04 Aug 2022 03:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Me8HVd4akmrED/T36rbRTRWBPVBTGtyF8bcqg06Vfbo=; b=kmNu2ByPSrPc6Hxgk74J0H8bULyvNqR1ctTynD8mGbFXuBNWwx5aND629jUbVSjHpY ysROcin+O3DXZIYTVN/af3aVodgj1rAqlA4Wxd2b/VLF5AOsMuNJRCEYF/eJqKQCYKYB xfz5dGMkziLQTdijd+g7leoe4wEKiXYpMfJcJJcSqVOEp3BfoE+OYuXUjsh5gLeZN2g1 LmVRnIQ3SPWXTl9zuLL6ChCiQvvGkRy0nu/gNr4F4YSn2l/vX5eQ8JcF95QxsVaSrQjR cuqINLxG7TeiJGdQ84vg3xlnhzJjIXG4KrxPTjcqNb6RijGVrYZ68RGDOkcZZ2m1a81D QFFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Me8HVd4akmrED/T36rbRTRWBPVBTGtyF8bcqg06Vfbo=; b=B3mNV87t+JUdVOrXmfKpkufCPiXYOCULX2VeBIMJnccXRfJydlNDxtL1EgZ1rxL6A6 u3cQ9xsk522FIqIP2yU3fd7TI2R3xxHuW8FMmz2TosvnRhsAMdDt7/jaAl8bxQQIPn+9 nluOdNHqb+Kmo10J4lQIQuV5rSvC5MGEQqqDOh12YduPS/+HgNlxTbV9T+yjh8MEMk3S VFmMK01YRuJIiDM3ZDnBbmWPvL5zxA9kii800usAhKsPdVKMiou+Um8B3igsAJ138z7y Pd+q2gsCIgDQ4kLV2hfqdQoXjqkbcbr9yIV0yUbaS1GgEqk/h2kyQMRJ+vS6clNutTF8 7l7w== X-Gm-Message-State: ACgBeo04SjE9GO8hJPkVxnC6cGHkZlXnYhdewR5AgarFurbOemTWJaxk 4TQnk6a4d5uhsqbvJmBB2iA= X-Google-Smtp-Source: AA6agR6LjT04xS+7iv3ggQBKdeatxyS3091gdVCmY1XI0zxWRux34omh61ffKz1is9TEfljvx8j6DQ== X-Received: by 2002:a5d:6d8a:0:b0:21d:a6f3:f458 with SMTP id l10-20020a5d6d8a000000b0021da6f3f458mr1020646wrs.574.1659609342305; Thu, 04 Aug 2022 03:35:42 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id g6-20020a05600c4ec600b003a3199c243bsm8177186wmq.0.2022.08.04.03.35.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Aug 2022 03:35:41 -0700 (PDT) Content-Language: en-US In-Reply-To: <3d639ea12689d767ba2a@heytings.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:238722 Archived-At: On 04.08.2022 04:26, Gregory Heytings wrote: >> Here I'm attaching a version of downloadify.js we can use for >> comparison (please rename the extension from .sj to .js locally; Gmail >> was not letting it through otherwise). It's not a huge file, just >> about 88K. >> > > It's a tiny file, not in any way representative of the ones we're > dealing with.  But amusingly, even with that tiny file, you can see the > problem at hand.  Do M-: (setq long-line-threshold nil) RET, and open it > in a large enough window (e.g. 160 characters).  Type M->, and try to > move point there with C-p or C-n.  You'll see that Emacs is already > sluggish. That's the scenario I described, and that's my point: this file's display is sluggish. Even though font-lock has already finished its work. And it didn't have to spend any significant time in syntax-ppss. So there is a particular performance problem with the display of fontified buffers which I'd really like your help in fixing. Fixing in a way that doesn't add narrowing around fontification-functions, because as we can see it's not necessary in examples like this. Then it would be much easier to evaluate font-lock's effect on performance in larger files. >> I'm also attaching a screenshot of another problem: suddenly the >> bottom several screens of the buffer are mis-highlighted as if >> starting inside a string. That very much look like a result of >> breaking syntax-ppss's visibility of the buffer. >> >> So the buffer scrolls quickly but looks bad. >> > > If you dislike mis-fontification, turn font-lock mode off.  It's as easy > as that.  Mis-fontification is expected in such cases.  The docstring of > syntax-wholeline-max also mentions that "misfontification may then > occur". Why did you not protest at that time? I think we could have both speed and correctness, at least for files of this size. >> Branch feature/long-lines-and-font-locking, revision cd41ce8c6c1079 >> from July 25. That branch is not there anymore, so let me know if I >> should re-test this with some later version of your work. >> > > That branch doesn't exist anymore, it has been merged in master. Thanks.