Subject: bug#75342: [PATCH] Speed up asynchronous man page fontifying

From: Stefan Kangas <[email-masked]>
Date: Fri, 10 Jan 2025 19:59:59 +0000

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked], Stefan Kangas <[email-masked]>
>> Date: Fri, 10 Jan 2025 16:36:36 +0200
>> From:  Björn Bidar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>>
>> Juri Linkov <[email-masked]> writes:
>>
>> >> I tried the patch on OpenSUSE Linux:
>> >> - with patch: gcc-14 man page formatted [in 12.790 seconds]
>> >> - without patch: gcc-14 man page formatted [in 24.272 seconds]
>> >>
>> >> Man-prefer-synchronous-call t: gcc-14 man page formatted [in 0.559 seconds]
>> >>
>> >> I was surprised how fast the synchronous formatting was. Why is the
>> >> asynchronous operating so slow?
>> >
>> > Maybe it performs full redisplay after processing every small chunk?
>> > When the synchronous formatting is so fast, it makes sense to enable
>> > Man-prefer-synchronous-call by default.  By speed up asynchronous
>> > would be nice in any case regardless of the default value.
>>
>> Can we disable or delay redisplay during processing of every chunk?
>
> Are you sure it's redisplay that takes the time?  Not the repeated
> processing of the same section of the man page after each small chunk
> we read?

My benchmarking suggests that it's due to the repeated processing,
indeed.  You can see this effect by removing the bug fix for Bug#36927
on top of my most recent patch, which all but removes the performance
regression for the asynchronous case.