Skip to content
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

centaur-tabs Causing High CPU Use #222

Open
Addlai opened this issue Sep 22, 2023 · 1 comment
Open

centaur-tabs Causing High CPU Use #222

Addlai opened this issue Sep 22, 2023 · 1 comment

Comments

@Addlai
Copy link

Addlai commented Sep 22, 2023

I've seen a couple of posts on similar issues in the past, such as
Centaur Tabs causing high CPU on macOS #88
(which is closed).

The problem is that according to the profiler
centaur-tabs-line
gets called about 100 times on every UI action, such as a key press or a mouse click. This makes Emacs unusably slow when I define a non-trivial centaur-tabs-buffer-groups function.

@feluxe
Copy link

feluxe commented Mar 6, 2024

I use doom on Linux and centaur-tabs is hitting my cpu quite heavily. Almost 50% of the entire doom-emacs load come from centaur-tabs alone:

7373  78% - redisplay_internal (C function)
7269  77%  - eval
4505  47%   + centaur-tabs-line
1387  14%   + doom-modeline-format--main
 354   3%   + doom-modeline-segment--modals
 172   1%   + doom-modeline-segment--buffer-info
  27   0%   + doom-modeline-segment--buffer-position
  16   0%   + doom-modeline-segment--matches
  14   0%     doom-modeline-segment--remote-host
  10   0%   + doom-modeline-segment--irc
   9   0%   + doom-modeline-segment--vcs
   9   0%   + doom-modeline-segment--checker
...

Update: If I let the profiler run a little longer the result is worse (64%).

More detailed result:

14703  81% - redisplay_internal (C function)
14590  81%  - eval
11647  64%   - centaur-tabs-line
11540  64%    - centaur-tabs-current-tabset
11537  64%     - centaur-tabs-buffer-tabs
11279  62%      - centaur-tabs-buffer-update-groups
11081  61%       - cl-mapcar
  289   1%        - #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_37>
  177   0%         - centaur-tabs-buffer-groups
  101   0%            derived-mode-p
   99   0%       - centaur-tabs-buffer-list
   47   0%          cl-mapcar
   28   0%        - centaur-tabs-filter-out
   28   0%         - cl-mapcar
   18   0%            #<compiled -0x14ab239a38100771>
   20   0%        centaur-tabs-put-cache
 1449   8%   - doom-modeline-format--main
...
   20   0%   - window-at-side-p
   20   0%      window-pixel-edges
 2860  15% + ...
  341   1% + command-execute
   28   0% + timer-event-handler

hlissner pushed a commit to doomemacs/doomemacs that referenced this issue Apr 6, 2024
`centaur-tabs-buffer-update-groups` walks every buffer to determine the
group it belongs to. This function can be called execessively (upwards
of 1,000 times per second in certain conditions), as it is called on
every redisplay (it is indirectly attached to `tab-line-format`). This
rate limits its calls to about 10 per second.

Close: #7792
Ref: ema2159/centaur-tabs#222
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

2 participants