unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* switch-to-buffer slow on PGTK
@ 2024-02-01 11:24 Jonas Damm
  2024-02-01 14:21 ` Tassilo Horn
  0 siblings, 1 reply; 8+ messages in thread
From: Jonas Damm @ 2024-02-01 11:24 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I am using emacs 30 (GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu,
GTK+ Version 3.24.38, cairo version 1.16.0) of 2024-02-01) on Debian
Sway (wayland) on a ryzen 3600G with 32G of fast memory.

switch-to-buffer gets slower and slower, the longer the
machine is running. After starting emacs fresh, its pretty quick. After
around one day of using, the function takes more then 3 seconds to show
the list of buffers and typing to match a buffer name still takes some
seconds to register.

The same issue happens on an older Notebook with emacs 29 (also sway).

Thanks for any help.
Jonas



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 11:24 switch-to-buffer slow on PGTK Jonas Damm
@ 2024-02-01 14:21 ` Tassilo Horn
  2024-02-01 16:48   ` Jonas Damm
  0 siblings, 1 reply; 8+ messages in thread
From: Tassilo Horn @ 2024-02-01 14:21 UTC (permalink / raw)
  To: Jonas Damm; +Cc: help-gnu-emacs

Jonas Damm <mailing@jonas-damm.de> writes:

Hi Jonas,

> I am using emacs 30 (GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu,
> GTK+ Version 3.24.38, cairo version 1.16.0) of 2024-02-01) on Debian
> Sway (wayland) on a ryzen 3600G with 32G of fast memory.
>
> switch-to-buffer gets slower and slower, the longer the
> machine is running.

How many open buffers do you have?

  M-: (length (buffer-list)) RET

will tell you.  If it's an unusal amount, you can eval

  (dolist (b (buffer-list))
    (message "%S" (buffer-name b))) <=== C-x C-e here!

in order to print all buffers' names to *Messages*.  My guess is you use
some package which creates buffers over buffers without cleaning up.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 14:21 ` Tassilo Horn
@ 2024-02-01 16:48   ` Jonas Damm
  2024-02-01 17:00     ` Tassilo Horn
  0 siblings, 1 reply; 8+ messages in thread
From: Jonas Damm @ 2024-02-01 16:48 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Jonas Damm, help-gnu-emacs

Currently i have 37 Buffers open. I think thats normal.
My uptime is only a few hours and switch-to-buffer takes already more
then a second.

Tassilo Horn <tsdh@gnu.org> writes:

> Jonas Damm <mailing@jonas-damm.de> writes:
>
> Hi Jonas,
>
>> I am using emacs 30 (GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu,
>> GTK+ Version 3.24.38, cairo version 1.16.0) of 2024-02-01) on Debian
>> Sway (wayland) on a ryzen 3600G with 32G of fast memory.
>>
>> switch-to-buffer gets slower and slower, the longer the
>> machine is running.
>
> How many open buffers do you have?
>
>   M-: (length (buffer-list)) RET
>
> will tell you.  If it's an unusal amount, you can eval
>
>   (dolist (b (buffer-list))
>     (message "%S" (buffer-name b))) <=== C-x C-e here!
>
> in order to print all buffers' names to *Messages*.  My guess is you use
> some package which creates buffers over buffers without cleaning up.
>
> Bye,
> Tassilo




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 16:48   ` Jonas Damm
@ 2024-02-01 17:00     ` Tassilo Horn
  2024-02-01 17:15       ` Jonas Damm
  0 siblings, 1 reply; 8+ messages in thread
From: Tassilo Horn @ 2024-02-01 17:00 UTC (permalink / raw)
  To: Jonas Damm; +Cc: Users list for the GNU Emacs text editor

Am Do, 1. Feb 2024, um 17:48, schrieb Jonas Damm:
> Currently i have 37 Buffers open. I think thats normal.

Alright, then it's something else.

Have a look at the Emacs profiler, e.g., the commands profiler-start and friends. There's surely also a section in the manual. That should show where the time is spent.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 17:00     ` Tassilo Horn
@ 2024-02-01 17:15       ` Jonas Damm
  2024-02-01 17:19         ` Tassilo Horn
  0 siblings, 1 reply; 8+ messages in thread
From: Jonas Damm @ 2024-02-01 17:15 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Jonas Damm, Users list for the GNU Emacs text editor

This is the output of the profiler:


     22,744,487  98% + command-execute
        453,256   1% + redisplay_internal (C function)
          7,279   0%   Automatic GC
            912   0% + timer-event-handler
             21   0% + help-command-error-confusable-suggestions
              0   0%   ...

How can i narrow it down further?
Thanks!
"Tassilo Horn" <tsdh@gnu.org> writes:

> Am Do, 1. Feb 2024, um 17:48, schrieb Jonas Damm:
>> Currently i have 37 Buffers open. I think thats normal.
>
> Alright, then it's something else.
>
> Have a look at the Emacs profiler, e.g., the commands profiler-start
> and friends. There's surely also a section in the manual. That should
> show where the time is spent.
>
> Bye,
> Tassilo




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 17:15       ` Jonas Damm
@ 2024-02-01 17:19         ` Tassilo Horn
  2024-02-01 19:51           ` Jonas Damm
  2024-02-03 13:27           ` Jonas Damm
  0 siblings, 2 replies; 8+ messages in thread
From: Tassilo Horn @ 2024-02-01 17:19 UTC (permalink / raw)
  To: Jonas Damm; +Cc: Users list for the GNU Emacs text editor

Am Do, 1. Feb 2024, um 18:15, schrieb Jonas Damm:
> This is the output of the profiler:
>
>      22,744,487  98% + command-execute
>         453,256   1% + redisplay_internal (C function)
>           7,279   0%   Automatic GC
>             912   0% + timer-event-handler
>              21   0% + help-command-error-confusable-suggestions
>               0   0%   ...
>
> How can i narrow it down further?

You can expand the tree below command-execute by clicking on the + sign. But note that the time (22secs) also contains the time Emacs waited for your input.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 17:19         ` Tassilo Horn
@ 2024-02-01 19:51           ` Jonas Damm
  2024-02-03 13:27           ` Jonas Damm
  1 sibling, 0 replies; 8+ messages in thread
From: Jonas Damm @ 2024-02-01 19:51 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Jonas Damm, Users list for the GNU Emacs text editor

Thanks, I think i narrowed it down to the function ivy-rich-switch-buffer-root-lookup

     12,751,393  97% - command-execute
     12,751,393  97%  - funcall-interactively
      9,030,352  68%   - ivy-switch-buffer
      9,030,352  68%    - ivy-read
      9,030,352  68%     - apply
      9,030,352  68%      - #<subr ivy-read>
      8,992,824  68%       - read-from-minibuffer
      8,824,107  67%        - ivy--queue-exhibit
      8,824,107  67%         - ivy--exhibit
      8,817,497  67%          - ivy--update-minibuffer
      8,816,473  67%           - ivy--format
      8,815,449  67%            - ivy-rich--ivy-switch-buffer-transformer
      8,815,449  67%             - ivy-rich-format
      8,814,401  67%              - #<compiled -0x98309b0fa9e758e>
      8,814,401  67%               - ivy-rich-format-column
      4,577,350  34%                - ivy-rich-switch-buffer-project
      4,577,350  34%                 - ivy-rich-switch-buffer-root
      4,576,302  34%                  + ivy-rich-switch-buffer-root-lookup
          1,048   0%                    ivy-rich--switch-buffer-directory
      4,201,388  32%                - ivy-rich-switch-buffer-path
      4,201,388  32%                 - ivy-rich--switch-buffer-root-and-filename
      4,201,388  32%                  - ivy-rich-switch-buffer-root
      4,201,388  32%                   - ivy-rich-switch-buffer-root-lookup
 
"Tassilo Horn" <tsdh@gnu.org> writes:

> Am Do, 1. Feb 2024, um 18:15, schrieb Jonas Damm:
>> This is the output of the profiler:
>>
>>      22,744,487  98% + command-execute
>>         453,256   1% + redisplay_internal (C function)
>>           7,279   0%   Automatic GC
>>             912   0% + timer-event-handler
>>              21   0% + help-command-error-confusable-suggestions
>>               0   0%   ...
>>
>> How can i narrow it down further?
>
> You can expand the tree below command-execute by clicking on the +
> sign. But note that the time (22secs) also contains the time Emacs
> waited for your input.
>
> Bye,
> Tassilo




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: switch-to-buffer slow on PGTK
  2024-02-01 17:19         ` Tassilo Horn
  2024-02-01 19:51           ` Jonas Damm
@ 2024-02-03 13:27           ` Jonas Damm
  1 sibling, 0 replies; 8+ messages in thread
From: Jonas Damm @ 2024-02-03 13:27 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Jonas Damm, Users list for the GNU Emacs text editor

I think i fixed it, by adding

(setq ivy-rich-project-root-cache-mode t)

to my config. So far everything seem snappy.
Thanks!
"Tassilo Horn" <tsdh@gnu.org> writes:

> Am Do, 1. Feb 2024, um 18:15, schrieb Jonas Damm:
>> This is the output of the profiler:
>>
>>      22,744,487  98% + command-execute
>>         453,256   1% + redisplay_internal (C function)
>>           7,279   0%   Automatic GC
>>             912   0% + timer-event-handler
>>              21   0% + help-command-error-confusable-suggestions
>>               0   0%   ...
>>
>> How can i narrow it down further?
>
> You can expand the tree below command-execute by clicking on the + sign. But note that the time (22secs) also contains the time Emacs waited for your input.
>
> Bye,
> Tassilo




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-03 13:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 11:24 switch-to-buffer slow on PGTK Jonas Damm
2024-02-01 14:21 ` Tassilo Horn
2024-02-01 16:48   ` Jonas Damm
2024-02-01 17:00     ` Tassilo Horn
2024-02-01 17:15       ` Jonas Damm
2024-02-01 17:19         ` Tassilo Horn
2024-02-01 19:51           ` Jonas Damm
2024-02-03 13:27           ` Jonas Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).