From: Eli Zaretskii <eliz@gnu.org>
To: Herman@debbugs.gnu.org, Géza <geza.herman@gmail.com>
Cc: 62352@debbugs.gnu.org, gregory@heytings.org
Subject: bug#62352: Very slow scroll-down-line with a lot of text properties
Date: Sat, 25 Mar 2023 19:20:45 +0300 [thread overview]
Message-ID: <83pm8wby5e.fsf@gnu.org> (raw)
In-Reply-To: <fbd68367-f8c6-a84b-29c7-801fc1b8b832@gmail.com> (message from Herman, Géza on Sat, 25 Mar 2023 16:24:50 +0100)
> Date: Sat, 25 Mar 2023 16:24:50 +0100
> Cc: gregory@heytings.org, 62352@debbugs.gnu.org
> From: Herman, Géza <geza.herman@gmail.com>
>
> > How can Emacs know that this is "unnecessary work"? You cannot know
> > if the buffer contains any composable characters unless you search for
> > them and fail to find them.
> Properties don't appear out of thin air, emacs is the one who puts the
> properties to characters. So Emacs could build a parallel data structure
> which contains this information in a better searchable way. This data
> structure can be lazily constructed/updated, if it's needed.
It is not easy to maintain such a cache. It needs to be kept up to
date at all times, and discarded/recreated when no longer accurate.
Any Lisp program can in principle add or remove text properties at any
moment, even inside a hook called by the display engine itself, such
as fontification-functions.
IOW, it is not as simple as you seem to think.
> Even, for my example problem, a simple
> "does-this-buffer-have-any-characters-with-composition-property" would
> be enough.
That would be a one-time condition. It could become false before the
next redisplay cycle. And checking this condition even once in a
large buffer with many text properties takes non-negligible time.
> I'm not saying that this is the solution I want. I'm just saying this
> because you asked.
Please believe me when I say that such shortcuts aren't possible, at
least not in the simplistic way you are suggesting them. There could
be some clever ideas that somehow do accomplish that, but I'd need to
see working code which implements them, not just ideas based on
simplifications of the real-life situations with which the Emacs
display code needs to cope in a production session.
It is no accident that any caches we do employ in the display code are
very localized and usually very short-lived; most are discarded when a
redisplay cycle ends.
> > That's not what I said, though.
> You said "So I think there's no bug here we need to look into". But I do
> think that there is a (performance) bug here.
There's a performance problem, I agree. But as long as the design of
the display engine is what it is, I don't see how that can be helped,
in a way that will cope much better with the massive amount of face
properties as in these examples.
> >>> Get a faster computer, or make your keyboard auto-repeat rate lower?
> >> Maybe there is a 2x single-thread performance factor between my computer
> >> and a current fast consumer desktop PC. It is highly unlikely that
> >> getting a faster computer will solve this problem.
> > My computer is a 10-year old machine.
> What is the conclusion then? You don't have this problem for some
> reason, or you do some part of the repro steps differently so it doesn't
> preproduce for you. Gregory Haythings could reproduce it, as far as I
> understand. So the problem is not at my side.
I didn't say the problem is on your side, I just mentioned the factors
that could cause it be more severe on your system than on mine.
> I attached scroll_problem.cpp, for which this problem is more apparent,
> maybe this reproduces for you.
Yes, it does. But only in scroll-down-line, not in scroll-up-line.
> This is the file for which emacs freezed
> for 40 seconds, when I moved the point to the bottom, and pressed and
> hold Shift-up for 1-2 seconds.
Here it "freezes" for just 4 to 5 seconds, not 40.
next prev parent reply other threads:[~2023-03-25 16:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 20:01 bug#62352: Very slow scroll-down-line with a lot of text properties Herman, Geza
2023-03-21 20:26 ` Eli Zaretskii
2023-03-21 20:39 ` Herman, Géza
2023-03-21 21:58 ` Gregory Heytings
2023-03-25 11:58 ` Eli Zaretskii
2023-03-25 12:33 ` Herman, Géza
2023-03-25 12:42 ` Eli Zaretskii
2023-03-25 13:41 ` Herman, Géza
2023-03-25 14:02 ` Eli Zaretskii
2023-03-25 15:24 ` Herman, Géza
2023-03-25 16:20 ` Eli Zaretskii [this message]
2023-03-25 17:38 ` Herman, Géza
2023-03-25 17:49 ` Eli Zaretskii
2023-03-25 21:39 ` Herman, Géza
2023-03-26 4:55 ` Eli Zaretskii
2023-03-26 7:14 ` Herman, Géza
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=83pm8wby5e.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=62352@debbugs.gnu.org \
--cc=Herman@debbugs.gnu.org \
--cc=geza.herman@gmail.com \
--cc=gregory@heytings.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 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).