From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#57447: 28.1.90; Can font-lock stop requesting fontification of invisible text? Date: Sat, 27 Aug 2022 18:37:36 +0800 Message-ID: <8735diezv3.fsf@localhost> References: <87fshi6ygu.fsf@localhost> <837d2u184w.fsf@gnu.org> <87bks66sfk.fsf@localhost> <831qt211tw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31067"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57447@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 27 12:37:12 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 1oRtBf-0007w8-HI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Aug 2022 12:37:11 +0200 Original-Received: from localhost ([::1]:58328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRtBe-0004a4-0t for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Aug 2022 06:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRtBX-0004ZU-55 for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2022 06:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRtBW-0002of-SF for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2022 06:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oRtBW-0001FP-IG for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2022 06:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Aug 2022 10:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57447 X-GNU-PR-Package: emacs Original-Received: via spool by 57447-submit@debbugs.gnu.org id=B57447.16615966034770 (code B ref 57447); Sat, 27 Aug 2022 10:37:02 +0000 Original-Received: (at 57447) by debbugs.gnu.org; 27 Aug 2022 10:36:43 +0000 Original-Received: from localhost ([127.0.0.1]:55284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRtBD-0001Er-AG for submit@debbugs.gnu.org; Sat, 27 Aug 2022 06:36:43 -0400 Original-Received: from mail-pf1-f172.google.com ([209.85.210.172]:39584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRtBA-0001Ec-Nk for 57447@debbugs.gnu.org; Sat, 27 Aug 2022 06:36:41 -0400 Original-Received: by mail-pf1-f172.google.com with SMTP id t129so3845789pfb.6 for <57447@debbugs.gnu.org>; Sat, 27 Aug 2022 03:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=vr5lQI1kMsUzuNqc4LFkGzj5L7pV3SGDpe1DGbDwXIE=; b=kx2OrjHQC1eywVJeygiWAFVFDcOC04bndX5/UG8QPma/ITs1eO2IGcJ5mh7p/YKaJV cbcFUvvsyM+2p68u/zYo0XvWer3h7CzIOApiWpN7EMkYPchcqcMSAKBfkzFnovP7K8Cr rlMVnNRV1WriuLpQ8p3WQGVFN8NHUZu2YgVn88ygyu6Y6bvHnRr8T4Vz41kYC73l9gCb BS3GJy8R2jC0sifrN6xBZIuU9rqKuLhc81NHmKnz2xiglOSQZRbX6DHo0XnJwtbiK0hj IB5W8lDQbrXsqShu1Be3oIBmFDG7N5lY7D3z321BHw7yeQORBAzhOTihGtf5z0GC7GaH tmxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=vr5lQI1kMsUzuNqc4LFkGzj5L7pV3SGDpe1DGbDwXIE=; b=YpjhICAsIPpnlhfEKQdfC76HuivSOkzT51GOYyFvnH3fK7yU6JAAXTwwKmky1PcXdA qpYHG04jE3WCveIflYlr07GquawQjxZF5a13s1NxuBxfCGgN/YDYecfs5q4kXq/6xCwY BUiZR8NoPnA/6fJh+5VAVd2rH+vYoQy/6AES/T3oF3ph3mUDEod02WO6TRYuDHyVDprw qsPCdBjkFR3PZr14/3AbVo/Rrumch9YSUrPNmHMMOz94Yxj6DdDJWWuFZxiDoXWzMY8L OwlQqmKzHZaXRfDPpsjl6aVDUBxMFpqBKmAuYR8eugvEoadxA5mMJ49el/uWjBcJnK21 TF1A== X-Gm-Message-State: ACgBeo3L9ne9o8V4/dX3WIFV+lSeTXKIE2pMmHukBdnEQSZZFsuz2yAE jsJW7TLUVPMMwqH4tjYkEBY= X-Google-Smtp-Source: AA6agR7hUXIthFlzP+mXNiMIL9JXLkvDrdQq8P9BU5zUisZmmL3Jx86jOq+ZvofVgpbvWk7QKpc9Gw== X-Received: by 2002:a62:17c8:0:b0:537:b287:3ef8 with SMTP id 191-20020a6217c8000000b00537b2873ef8mr7923777pfx.40.1661596594670; Sat, 27 Aug 2022 03:36:34 -0700 (PDT) Original-Received: from localhost ([2409:8a70:2b3:c8a0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id r11-20020a170902be0b00b00172ff99d0afsm3260805pls.140.2022.08.27.03.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Aug 2022 03:36:34 -0700 (PDT) In-Reply-To: <831qt211tw.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:240897 Archived-At: Eli Zaretskii writes: >> From: Ihor Radchenko >> Cc: 57447@debbugs.gnu.org >> Date: Sat, 27 Aug 2022 15:45:19 +0800 >> >> I did expect some invisible text to be fontified, but did not expect 10x >> increase in the requested text size. > > The increase depends on how much text is hidden in each chunk, > relative to jit-lock-chunk-size. If you have a lot of small shunks of > hidden text interspersed with visible text, you could have all of the > invisible text fontified. This is unfortunate. >> > One way this could be improved is by making jit-lock-chunk-size >> > smaller. This will make the probability of such "over-fontification" >> > lower. >> >> I tried to reduce the chunk size and at appears to help. However, I am >> not sure if there are other side effects of reducing >> jit-lock-chunk-size. > > If the size is smaller than the visible portion of the buffer, it will > cause repeated calls to fontification-functions, instead of just one > call. If fontification-functions do their job in approximately linear > time, you shouldn't see any adverse effects, I think. But if each > call to fontification-functions incurs some one-time overhead that is > relatively expensive, the result could be slower redisplay when the > window is scrolled a lot. This may be an issue in some scenarios. I am wondering if something like font-lock-extend-region-functions may be utilized to shrink the fontification boundaries. > I only want to test that if you see something that is inconsistent > with my description of how this stuff works, including the value of > jit-lock-chunk-size. If jit-lock-chunk-size must be an actual upper bound "Jit-lock fontifies chunks of at most this many characters at a time." then it does not always hold: jit-lock-chunk-size = 1500 | beg | end | chunk size | | 6083 | 6852 | 769 | | 7181 | 8725 | 1544 | | 9934 | 11570 | 1636 | | 11905 | 13418 | 1513 | | 13481 | 15094 | 1613 | | 15275 | 16796 | 1521 | | 16827 | 18389 | 1562 | | 18728 | 20395 | 1667 | | 20605 | 22161 | 1556 | | 22161 | 23795 | 1634 | #+TBLFM: $3=$2-$1 jit-lock-chunk-size = 150 | beg | end | chunk size | | 1 | 169 | 168 | | 169 | 319 | 150 | | 351 | 509 | 158 | | 532 | 708 | 176 | | 883 | 1043 | 160 | | 1142 | 1463 | 321 | | 1624 | 1780 | 156 | | 1895 | 2060 | 165 | | 2060 | 2235 | 175 | | 2235 | 2395 | 160 | | 2395 | 2562 | 167 | | 2677 | 2900 | 223 | | 3061 | 3294 | 233 | | 3392 | 3559 | 167 | | 3657 | 3813 | 156 | | 3849 | 4021 | 172 | | 4182 | 4534 | 352 | <- >2x chunk size | 4743 | 4902 | 159 | | 4938 | 5097 | 159 | | 5133 | 5313 | 180 | | 5313 | 5509 | 196 | | 5561 | 5751 | 190 | | 5751 | 5917 | 166 | | 5917 | 6077 | 160 | | 6077 | 6237 | 160 | | 6237 | 6397 | 160 | | 6460 | 6629 | 169 | | 7181 | 7364 | 183 | | 7829 | 7989 | 160 | | 9934 | 10199 | 265 | | 10478 | 10638 | 160 | | 11268 | 11432 | 164 | | 11905 | 12080 | 175 | | 12502 | 12683 | 181 | | 12746 | 12901 | 155 | | 13000 | 13156 | 156 | | 13241 | 13418 | 177 | | 13481 | 13664 | 183 | | 13716 | 13922 | 206 | | 14171 | 14336 | 165 | | 14336 | 14491 | 155 | | 14576 | 14741 | 165 | | 15275 | 15495 | 220 | | 15501 | 15751 | 250 | | 15877 | 16115 | 238 | | 16200 | 16366 | 166 | | 16451 | 16613 | 162 | | 16827 | 17091 | 264 | | 18728 | 18946 | 218 | | 19061 | 19240 | 179 | | 19416 | 19712 | 296 | <- 2x chunk size | 19810 | 19970 | 160 | | 20016 | 20193 | 177 | | 20245 | 20408 | 163 | | 20605 | 20770 | 165 | | 22161 | 22427 | 266 | | 22427 | 22590 | 163 | #+TBLFM: $3=$2-$1 -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92