Skip to content

exwm-layout--refresh-workspace is slow with many windows #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Stebalien opened this issue May 22, 2020 · 5 comments
Open

exwm-layout--refresh-workspace is slow with many windows #756

Stebalien opened this issue May 22, 2020 · 5 comments

Comments

@Stebalien
Copy link
Contributor

Whenever I open a minibuffer or re-arrange a window, EXWM runs exwm-layout--refresh-workspace. Unfortunately, I often have many (~75) windows open (I use windows with Firefox instead of tabs so I can manage them with EXWM).

This means 10-15% of the time is spent iterating over all the open windows.

With native-comp enabled:

- redisplay_internal (C function)                                 161  18%
 - exwm-layout--refresh                                           133  15%
  - exwm-layout--refresh-workspace                                 88  10%
   - exwm-layout--show                                             32   3%
    + exwm--set-geometry                                            4   0%
    + window-inside-absolute-pixel-edges                            3   0%
    + exwm-layout--set-ewmh-state                                   1   0%
    + xcb:flush                                                     1   0%
   + xcb:flush                                                      2   0%
   + exwm-layout--set-client-list-stacking                          1   0%

Without:

- redisplay_internal (C function)                                 124  13%
 - exwm-layout--refresh                                            97  10%
  - if                                                             97  10%
   - exwm-layout--refresh-workspace                                97  10%
    - let                                                          96  10%
     - dolist                                                      41   4%
      + cl-block                                                   41   4%
     - exwm-layout--set-client-list-stacking                        9   1%
      + xcb:-+request                                               9   1%
     + xcb:flush                                                    3   0%
     + let                                                          1   0%
@Stebalien
Copy link
Contributor Author

(note: this is hardly a high priority, just something I've noticed)

@ch11ng
Copy link
Owner

ch11ng commented May 24, 2020

Do you have exwm-layout-show-all-buffers turned on or are all the X windows on a same workspace?

exwm-layout--refresh-workspace is suboptimal in that it performs exwm-layout--show or exwm-layout--hide on all X windows on a certain workspace. This can be avoided if we trust the state of each X window.

@Stebalien
Copy link
Contributor Author

Do you have exwm-layout-show-all-buffers turned on or are all the X windows on a same workspace?

Both. I try to treat X windows as emacs buffers as much as possible.

This can be avoided if we trust the state of each X window.

Can X windows make themselves visible or is this just a matter of tracking known visible/invisible windows per workspace?

@medranocalvo
Copy link
Collaborator

(@Stebalien, could you have a look at #688/#737?)

I don't think it's easy. exwm-layout--refresh gets called in various circunstances (visible buffers changed [which could mean the X window must be moved to other workspace], window sizes changed, minibuffer, etc.). Perhaps we can cache part of the information and only update what changed. That might be possible for the two actions you mentioned.

@ch11ng
Copy link
Owner

ch11ng commented Jun 14, 2020

@Stebalien

Can X windows make themselves visible or is this just a matter of tracking known visible/invisible windows per workspace?

We'll need to save & update their states as what @medranocalvo had explained. I'd like to give this a try when I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants