ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
727 stars 50 forks source link

centaur-tabs Causing High CPU Use #222

Open Addlai opened 9 months ago

Addlai commented 9 months ago

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 commented 4 months ago

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