hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Do not call fundamental-mode if lv buffer is already in fundamental-mode

Open bcc32 opened this issue 1 year ago • 1 comments

Actually calling the fundamental-mode function can be a bit slow, because it involves running change-major-mode-hook and also doing a mode-line redisplay. When the lv buffer is re-created over and over, this can contribute to significant visual stuttering.

For example, in Spacemacs, pressing SPC w . (window transient state) and then holding down } (enlarge) lags heavily before this change, but is much smoother after.

Preserve the behavior of #364, however, to ensure that the lv buffer is still in the correct major-mode.

bcc32 avatar Aug 06 '24 15:08 bcc32

This change seems to be a definite improvement and would be great to see merged.

It does make a difference on my system, though the example of resizing windows in Spacemacs still stutters quite a bit for me. This is probably due to a combination of a relatively old CPU, a high key repeat rate, and non-trivial members in the relevant hooks. I had investigated the same underlying performance problem with the scroll transient state in Spacemacs and came up with this workaround: https://github.com/abo-abo/hydra/pull/422

fnussbaum avatar Sep 11 '24 23:09 fnussbaum