unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Herman@debbugs.gnu.org, Géza <geza.herman@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
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 22:39:34 +0100	[thread overview]
Message-ID: <aafc974d-56d1-4dce-7586-c1ad64aceb1b@gmail.com> (raw)
In-Reply-To: <83ileobu0t.fsf@gnu.org>



On 3/25/23 18:49, Eli Zaretskii wrote:
>> Date: Sat, 25 Mar 2023 18:38:19 +0100
>> Cc: gregory@heytings.org, 62352@debbugs.gnu.org
>> From: Herman, Géza <geza.herman@gmail.com>
>>
>>> IOW, it is not as simple as you seem to think.
>> I didn't meant to imply that it is easy. It is certainly not. But, tbh,
>> while emacs is fluid most of the time, it can be very stuttery
>> sometimes. In my experience, this is usually caused by some lisp code.
>> But when it isn't, it is usually caused by some code in this area. When
>> I profile emacs, these functions (next_property_change and similar) are
>> usually on the top of the list. So it would make sense to optimize
>> around this area. Not just because of this issue, but in general.
>>
>> I'm not necessarily suggesting a cache. Maybe it's better to actually
>> always manage additional data structures. So, if a text property is
>> added, it's not just set for the specific character area, but it will
>> also modify search structures right away. So additional data structures
>> were always in sync. Sure, it has some overhead. But if emacs does a lot
>> of linear searches (and having a look at these functions, I see a lot of
>> linear searches), this overhead will be quickly mitigated by the much
>> faster searches. For example, if emacs had a list which only contained
>> text segments with the composition property, the current 500-char area
>> search will be much faster.
> Emacs already handles text properties using an efficient data
> structure, see intervals.c.  Feel free to suggest improvements to the
> algorithms we use there.
The problem is not there. The problem is that find_composition is only 
interested in the composition property, yet it scans all the properties 
linearly. And it scans it for 500 characters. This file has a lot of 
properties, this means a lot of unnecessary and duplicated work (because 
it does this for each character displayed, or something like this). If 
the composition property had its own list, then this problem wouldn't exist.

Anyways, I commented out those lines, the problem is gone, and 
everything still seems to work. I'll report back if I find some problems 
with it.





  reply	other threads:[~2023-03-25 21:39 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
2023-03-25 17:38                   ` Herman, Géza
2023-03-25 17:49                     ` Eli Zaretskii
2023-03-25 21:39                       ` Herman, Géza [this message]
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=aafc974d-56d1-4dce-7586-c1ad64aceb1b@gmail.com \
    --to=herman@debbugs.gnu.org \
    --cc=62352@debbugs.gnu.org \
    --cc=eliz@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).