Skip to content

Reverting Room List Causes Mode Reinitialization #146

Closed
@treed

Description

@treed

While investigating an issue with UI pauses while Ement is running, I found that the proximate cause is the sync callback reverting the room list. This revert runs ement-room-list-mode again, which calls a bunch of other mode initialization things.

From what I can tell, the root cause of the slowness is add-hook sorting based on a depth list which has a lot of entries, which is its own problem, but alphapapa says that the revert shouldn't be reinitializing the mode anyway and that I should file an issue.

Here's a bit of the profile I captured, demonstrating the codepath:

        5185  50%         - plz--sentinel
        4900  47%          - #<compiled -0x1b4cf30a72447de8>
        4900  47%           - #<compiled 0x155d2ecf629f4be3>
        4900  47%            - apply
        4900  47%             - ement--sync-callback
        4900  47%              - run-hook-with-args
        4898  47%               - ement-room-list-auto-update
        4898  47%                - revert-buffer
        4898  47%                 - ement-room-list-revert
        4898  47%                  - ement-room-list
        4894  47%                   - ement-room-list-mode
        4894  47%                    - magit-section-mode
        4838  46%                     - special-mode
         747   7%                      - global-font-lock-mode-cmhh
         746   7%                       - add-hook
         746   7%                        - #<compiled -0x6171969eebf39b2>
         169   1%                           alist-get
         742   7%                      + envrc-global-mode-cmhh
         724   7%                      + global-jinx-mode-cmhh
         715   6%                      + whole-line-or-region-global-mode-cmhh
         685   6%                      + yas-global-mode-cmhh
         672   6%                      + global-eldoc-mode-cmhh
         553   5%                      + magit-auto-revert-mode-cmhh
          54   0%                     + add-hook
           3   0%                   + taxy-magit-section-insert
           1   0%                   + taxy-magit-section-format-items
           1   0%               - ement--auto-sync
           1   0%                - ement--sync
           1   0%                 + ement-api

This is with ement 0.8.1 via ELPA.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions