Severity: wishlist The below patch makes asynchronous fontifying of man pages faster. After typing `M-x man RET gcc-14 RET`, it takes around 5 minutes on this fast MacBook Pro M2 (2022) machine until the whole 1.43 MiB man page is displayed. With a hot cache, the best time I have managed to measure is 173.432 seconds. We seem to call `man--maybe-fontify-manpage` many times on very small chunks: on my machine, it processes ~30 characters at a time. Things get substantially faster if we make `Man-bgproc-filter` fontify the buffer in much larger chunks. The main drawback of doing this is that we risk very briefly seeing an incorrect display flash by in the man buffer (e.g., with `end-of-buffer`). My measurements show that 32 KiB might be a good choice, and gives a ~95% speedup: | Chunk size (KiB) | Completion time (s) | |------------------+---------------------| | 4 | 29.3 | | 8 | 18.2 | | 16 | 12.7 | | 32 | 7.4 | | 64 | 6.5 | | 128 | 5.4 | Is this the best approach to optimize something like this, or am I overlooking something obvious? Note that I didn't add a variable for the chunk size, but we could easily add one, if that'd be useful. When I set `Man-prefer-synchronous-call` to t, it takes ~1.8 seconds to process the same page. I guess that this is the lower bound for how fast we could make the asynchronous call. Please see the attached.