From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 75342@debbugs.gnu.org, juri@linkov.net
Subject: bug#75342: [PATCH] Speed up asynchronous man page fontifying
Date: Sat, 04 Jan 2025 10:27:29 +0200 [thread overview]
Message-ID: <86bjwnf0ge.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmkzr46ALhQv--D+EFadKpBKYjG-fri3MP51NsfdbsyYBg@mail.gmail.com> (message from Stefan Kangas on Sat, 4 Jan 2025 01:22:03 -0600)
> Cc: Juri Linkov <juri@linkov.net>
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sat, 4 Jan 2025 01:22:03 -0600
>
> 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`).
Man-bgproc-filter also affects how we process sections of the man
page, see bug#36927. Wouldn't larger chunks increase the probability
of making an error there?
> 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.
Why not make Man-prefer-synchronous-call t by default, then?
next prev parent reply other threads:[~2025-01-04 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 7:22 bug#75342: [PATCH] Speed up asynchronous man page fontifying Stefan Kangas
2025-01-04 8:12 ` Stefan Kangas
2025-01-04 8:27 ` Eli Zaretskii [this message]
2025-01-04 9:33 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <87msg63ov5.fsf@>
2025-01-04 10:03 ` Eli Zaretskii
2025-01-04 21:13 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <87frlywae5.fsf@>
2025-01-05 6:01 ` Eli Zaretskii
2025-01-04 21:04 ` Björn Bidar 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bjwnf0ge.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=75342@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=stefankangas@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).