[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debouncing slow mode line constructs (was: Emacs design and architec
From: |
Ihor Radchenko |
Subject: |
Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?) |
Date: |
Fri, 22 Sep 2023 10:23:47 +0000 |
Eli Zaretskii <eliz@gnu.org> writes:
>> What about automatically debouncing slow :eval constructs in the mode
>> line? If we make sure that :eval constructs running longer than a
>> threshold do not run too frequently, it can certainly improve user
>> experience.
>
> How do you propose to evaluate just portions of the mode line? What
> will the :eval whose processing is bypassed yield, and how will that
> affect processing of the rest of mode-line-format, given its
> highly-recursive processing structure and the fact that the text
> produced by this processing is laid out as it is produced?
What I have in mind is the following:
1. Every time Emacs processes :eval construct it (a) measures the time
taken; (b) caches return value.
The total mode line render time is also recorded.
2. If the total render time exceeds configurable threshold, processing
the most time-consuming :eval constructs will be suspended until
"debounce" time since the last full processing.
By "suspended", I mean that cached :eval value is reused instead of
invoking :eval again. Possibly, not reused verbatim, but by replacing
the cached value with some kind of placeholder that has the same
total height/width as the cached value.
For example, consider :eval segment invoking external git command and
producing branch name: "⛬ master".
If that command takes too long, Emacs will display
"⏳ " instead of
"⛬ master", until the mode-line redisplay that is some fixed time
ahead.
3. After "debounce" time since the last "suspend", all the :eval are
processed in full again, generating up-to-date mode-line.
In terms of values, I am thinking something like 0.2 sec for threshold
and 1.0 sec for debounce. This way, mode line will be outdated no longer
than 1 second.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), (continued)
- Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/21
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Dmitry Gutov, 2023/09/21
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/23
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/21
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?),
Ihor Radchenko <=
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Eli Zaretskii, 2023/09/22
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Ihor Radchenko, 2023/09/23
- Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Dmitry Gutov, 2023/09/22
- RE: [External] : Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?), Drew Adams, 2023/09/22
- Re: Emacs design and architecture. How about copy-on-write?, Eli Zaretskii, 2023/09/21
- Re: Emacs design and architecture. How about copy-on-write?, Dmitry Gutov, 2023/09/21