all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: geza.herman@gmail.com
Cc: gregory@heytings.org, 62352-done@debbugs.gnu.org
Subject: bug#62352: Very slow scroll-down-line with a lot of text properties
Date: Sat, 25 Mar 2023 15:42:20 +0300	[thread overview]
Message-ID: <83h6u9c89f.fsf@gnu.org> (raw)
In-Reply-To: <d35cfe8a-b2a4-c919-9182-1905060a4362@gmail.com> (message from Herman, Géza on Sat, 25 Mar 2023 13:33:53 +0100)

> Date: Sat, 25 Mar 2023 13:33:53 +0100
> Cc: 62352-done@debbugs.gnu.org
> From: Herman, Géza <geza.herman@gmail.com>
> 
> There is a behavior difference. I'm not sure what the exact reason is, 
> but the two different scrolls behave differently.
> 
> With a more complex case (~250 lines, each line is 150 characters long), 
> I can scroll "normally" from the bottom to the top in ~5 seconds (with 
> scroll-conservatively=101). The scrolling stutters. If I disable 
> font-lock, it won't get any faster, still ~5 seconds (but fluid).

Like I said: the threshold where it starts stuttering depends on many
local factors.  Basically, the code does a very similar job, except
that in one case it needs to determine the window's starting position,
while in the other it doesn't (so the jobs the code does are somewhat
different).

> I analyzed the issue little bit, the root cause of the slowdown is 
> composition handling (yet the composition feature is completely unused 
> by this example).
> 
> If I comment out these lines in composition_compute_stop_pos(), emacs 
> works better ("normal" scrolling becomes completely fluid, 
> scroll-down-line still freezes, but for a much shorter time):
> 
>    /* if (charpos < endpos */
>    /*     && find_composition (charpos, endpos, &start, &end, &prop, 
> string) */
>    /*     && start >= charpos */
>    /*     && composition_valid_p (start, end, prop)) */
>    /*   { */
>    /*     cmp_it->stop_pos = endpos = start; */
>    /*     cmp_it->ch = -1; */
>    /*   } */
> 
> It seems that emacs does a huge amount of redundant work by scanning 
> approximately the same area over and over again for composition properties.

This is a non-starter, unfortunately: the display engine _must_
support character composition, or else some scripts will display
incorrectly, and some features (like prettify-symbols-mode) will stop
working.

If you never need to display scripts which require character
composition, turn off auto-composition-mode in your local
configuration (but then expect incorrect display with some
characters).

> I'm not sure how it is possible that you don't see any stuttering with 
> scroll-down-line. On my system it freezes for seconds with my original 
> example (and others can also reproduce it).

Get a faster computer, or make your keyboard auto-repeat rate lower?





  reply	other threads:[~2023-03-25 12:42 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h6u9c89f.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=62352-done@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 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.