bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62780: 30.0.50; Redisplay gets slow when using Org tables + show-tra


From: Ihor Radchenko
Subject: bug#62780: 30.0.50; Redisplay gets slow when using Org tables + show-trailing-whitespace
Date: Fri, 14 Apr 2023 09:20:01 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> This looks up a very specific text property - 'composition.
>
> Are you sure?  look up_char_property is also called for processing
> 'display' properties.  Here's the chain:
>
>  handle_display_prop
>   -> get_char_property_and_overlay
>       -> Fget_text_property
>           -> textget
>             -> lookup_char_property

AFAIU, it does not show up in the call graph.
So, even if it is called, somehow, it should be fewer times. May
composition be queried excessively compared to 'display?

>> Or, may it make sense to maintain additional interval trees for some
>> important text properties like 'invisible/'composition/'display? These
>> trees will only track text regions containing these important text
>> properties? Then, `next-single-property-change' can be much, much faster
>> compared to the current scan across all the buffer intervals.
>
> These ideas came up before, but implementing them is not easy and
> would add quite a bit of complexity.

Is it a problem to keep multiple interval trees: one for all properties,
and several for individual properties? Then, all the code dealing with
intervals can be extended, repeating interval tree edits for the extra
trees. When the special properties are requested, we can then work with
special trees instead.

> We could, perhaps, keep a
> buffer-local flag to record whether 'composition' property was ever
> set on any buffer text, but once the flag is set, we won't easily know
> if it could be reset.

I do not feel like it will improve things in practice - complex buffers
with 'display/'composition properties are the ones that tend to be slow.
Simpler buffers with less text properties are already not problematic.

> Moreover, I just disabled static compositions completely, by making
> find_composition return zero immediately, which basically avoids the
> calls to next/previous-single-property-change which search for
> 'composition' property, and I still see quite a significant slowdown
> with the recipe of this bug (50x30 org-table).  Can you reproduce
> this?  If you can, what does the profile say now?

I cannot reproduce.
The typing has no noticeable delays.

I used ./configure && make with

@@ -421,6 +421,7 @@ find_composition (ptrdiff_t pos, ptrdiff_t limit,
                  ptrdiff_t *start, ptrdiff_t *end,
                  Lisp_Object *prop, Lisp_Object object)
 {
+  return 0;

Best,
Ihor





reply via email to

[Prev in Thread] Current Thread [Next in Thread]