From: Ihor Radchenko <yantar92@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 57447@debbugs.gnu.org
Subject: bug#57447: 28.1.90; Can font-lock stop requesting fontification of invisible text?
Date: Sat, 27 Aug 2022 18:37:36 +0800 [thread overview]
Message-ID: <8735diezv3.fsf@localhost> (raw)
In-Reply-To: <831qt211tw.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Ihor Radchenko <yantar92@gmail.com>
>> 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
next prev parent reply other threads:[~2022-08-27 10:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 5:34 bug#57447: 28.1.90; Can font-lock stop requesting fontification of invisible text? Ihor Radchenko
2022-08-27 7:02 ` Eli Zaretskii
2022-08-27 7:45 ` Ihor Radchenko
2022-08-27 9:18 ` Eli Zaretskii
2022-08-27 10:37 ` Ihor Radchenko [this message]
2022-08-27 11:05 ` Eli Zaretskii
2022-08-27 11:11 ` Ihor Radchenko
2022-08-27 11:17 ` Eli Zaretskii
2022-08-27 11:24 ` Ihor Radchenko
2022-08-27 15:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-27 15:25 ` Eli Zaretskii
2022-08-28 1:23 ` Ihor Radchenko
[not found] ` <jwvtu5wsa21.fsf-monnier+emacs@gnu.org>
[not found] ` <87r10xp07l.fsf@localhost>
[not found] ` <jwvy1v4giz3.fsf-monnier+emacs@gnu.org>
[not found] ` <875yi7o8x3.fsf@localhost>
[not found] ` <jwvmtbjgmrs.fsf-monnier+emacs@gnu.org>
[not found] ` <jwvo7vsb3fz.fsf-monnier+emacs@gnu.org>
[not found] ` <8735d2pghv.fsf@localhost>
2022-09-09 14:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735diezv3.fsf@localhost \
--to=yantar92@gmail.com \
--cc=57447@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.