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

Noticeably slower when running remotely #618

Closed
murphytalk opened this issue Oct 17, 2017 · 6 comments
Closed

Noticeably slower when running remotely #618

murphytalk opened this issue Oct 17, 2017 · 6 comments

Comments

@murphytalk
Copy link

murphytalk commented Oct 17, 2017

This is a fantastic collection of emacs goodies, I forked yours a while ago and have been keeping it sync-ed with your repo, thank you!

Regarding the performance, when running locally (on PC) there is no slowness whatsoever, but using the same configuration to run emacs25 on a remote server is noticeably slower, tried both emacs-nox in ssh terminal and emacs X11 (using Exceed X-Server with ssh X11 tunneling).

The typical syndrome is that emacs would freeze for several seconds or even longer when C-s or M-x, then resumes. I've tried this on both our Redhat 6.5 box (Cisco UCS physical blade) and Solaris box (M-6000), same experience.

Network latency shouldn't be an issue, as the servers are in a DC only a few kilometers away and we are on the fast corp network, all the other apps just work fine.

Very much appreciated if you can shed some light and give some advice on troubleshooting. Thanks.

@redguardtoo
Copy link
Owner

turn off auto-save on init-misc.el.

The slow commands you mentioned are from swiper/counsel. M-x profiler-start, run slow command, M-x profiler-report

@murphytalk
Copy link
Author

murphytalk commented Oct 18, 2017

auto-save was already turned off quite a while ago.

Indeed counsel counts for a big chunk of CPU usage ... any advice ?

- command-execute                                               22039  87%
 - call-interactively                                           22039  87%
  - funcall-interactively                                       22039  87%
   - my-M-x                                                     18096  71%
    - cond                                                      18096  71%
     - counsel-M-x                                              18096  71%
      - let*                                                    18096  71%
       - ivy-read                                               12955  51%
        - let*                                                  12955  51%
         - progn                                                12954  51%
          - progn                                               12954  51%
           - let                                                12954  51%
            - prog1                                             12933  51%
             - unwind-protect                                   12933  51%
              - let                                             12931  51%
               + unwind-protect                                 12931  51%
              + ivy-overlay-cleanup                                 2   0%
            + ivy--reset-state                                     21   0%
         + car                                                      1   0%
       - if                                                      5141  20%
        - progn                                                  5141  20%
         - if                                                    5141  20%
          - progn                                                4640  18%
           - smex-update                                         4640  18%
            - smex-rebuild-cache                                 4640  18%
             - setq                                              4023  15%
              - sort                                             3888  15%
               - smex-sorting-rules                              3397  13%
                - let*                                           2232   8%
                 + or                                            1339   5%
                   length                                         195   0%
              + smex-convert-for-ido                               52   0%
             + let                                                615   2%
             + smex-restore-history                                 2   0%
          - smex-detect-new-commands                              501   1%
           + let                                                  501   1%
   - swiper                                                      3705  14%
    - swiper--ivy                                                3705  14%
     - let                                                       2881  11%
      - unwind-protect                                           2880  11%
       - and                                                     2880  11%
        - setq                                                   2880  11%
         - ivy-read                                              2880  11%
          - let*                                                 2880  11%
           - progn                                               2880  11%
            - progn                                              2880  11%
             - let                                               2880  11%
              - prog1                                            2832  11%
               - unwind-protect                                  2832  11%
                - let                                            2832  11%
                 - unwind-protect                                2832  11%
                  - progn                                        2832  11%
                   - let*                                        2832  11%
                    - if                                         2832  11%
                     + read-from-minibuffer                       592   2%
              + ivy--reset-state                                   48   0%
      + if                                                          1   0%
     + swiper--candidates                                         824   3%
   + next-line                                                    238   0%
+ ...                                                            2862  11%
+ timer-event-handler                                             324   1%

@redguardtoo
Copy link
Owner

Can you re-test and expand unwind-protect (51% CPU) just above the line of ivy-overlay-cleanup to the leaf node?

@murphytalk
Copy link
Author

Here you go ... it looks the if condition alone used 39% ? Does this command need to scan and iterate through files? One possible reason that I can think of is that on the servers my home directory is mounted from NFS, which is slower than local file system as we know ...

             - unwind-protect                                   12933  51%
              - let                                             12931  51%
               - unwind-protect                                 12931  51%
                - progn                                         12931  51%
                 - let*                                         12931  51%
                  - if                                          12931  51%
                   - read-from-minibuffer                        3067  12%
                    + #<lambda 0x1b6404eb6be384ec>                670   2%
                    + ivy--exhibit                                429   1%
                    + timer-event-handler                         185   0%
                    + redisplay_internal (C function)                 12   0%
                    + command-execute                               8   0%
                    + minibuffer-inactive-mode                      6   0%
                    + my-minibuffer-setup-hook                      1   0%
                    + global-font-lock-mode-check-buffers                  1   0%
                    + frame-windows-min-size                        1   0%
              + ivy-overlay-cleanup                                 2   0%
            - ivy--reset-state                                     21   0%
             - let                                                 21   0%
              - setq                                               21   0%
               - if                                                21   0%
                - ivy-thing-at-point                               21   0%
                 - or                                              21   0%
                  - thing-at-point                                 20   0%
                   - thing-at-point-url-at-point                   20   0%
                    - thing-at-point-bounds-of-url-at-point                 20   0%
                     - thing-at-point--bounds-of-well-formed-url                 20   0%
                      - regexp-opt                                 20   0%
                       - regexp-opt-group                          17   0%
                        - regexp-opt-group                         16   0%
                         + regexp-opt-group                        16   0%
                         delete-dups                                2   0%
                  + and                                             1   0%
         + car                                                      1   0%
       - if                                                      5141  20%

@redguardtoo
Copy link
Owner

I'm not developer of counsel/ivy, so I can only guess. Looks initially there are too many candidates, so most time is wasted to rendering in mini-buffer.

You can re-binding M-x to smex which using ido. For swiper, you can select string at first (press ,xx), then swiper (press ,ss).

I suggest you also submit bug report to @abo-abo, and reference this issue in the report so he can improve swiper/counsel/ivy

@redguardtoo
Copy link
Owner

See abo-abo/swiper#1218
It's partially resolved by ((setq ivy-dynamic-exhibit-delay-ms 200)

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