emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: org-mode <emacs-orgmode@gnu.org>
Subject: Org-mode pcomplete is slow, affect performance
Date: Sat, 05 May 2018 17:58:17 +0800	[thread overview]
Message-ID: <87a7teifuu.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

I use Emacs profiler profiled company-capf in Org-mode buffer.
Here is an org-mode buffer test snippet (in a big Org file):

#+begin_src clojure :results pp
(nth '(1 2 3) 1)
#+end_src

Profiler result in attachments. It has very recursive deep file-truename
invoking.


[-- Attachment #2: profiler-cpu.txt --]
[-- Type: text/plain, Size: 6244 bytes --]

+ command-execute                                                4769  56%
- company-post-command                                           1645  19%
 - company--perform                                              1555  18%
  - company--continue                                            1539  18%
   - company-calculate-candidates                                1539  18%
    - company--postprocess-candidates                            1536  18%
     - company--transform-candidates                             1536  18%
      - company-sort-by-occurrence                               1536  18%
       - cl-delete-if                                            1536  18%
        - apply                                                  1536  18%
         - cl-delete                                             1536  18%
          - #<compiled 0xe4f5055>                                1536  18%
           - company--occurrence-predicate                       1523  18%
            - company-call-backend                               1519  17%
             - company--force-sync                               1519  17%
              - apply                                            1519  17%
               - company-call-backend-raw                        1519  17%
                - apply                                          1519  17%
                 - company-capf                                  1516  17%
                  - company--capf-data                           1513  17%
                   - company--capf-data-real                     1513  17%
                    - run-hook-wrapped                           1513  17%
                     - completion--capf-wrapper                  1513  17%
                      - pcomplete-completions-at-point               1510  17%
                       - pcomplete-completions                   1203  14%
                        - pcomplete/org-mode/block-option/src               1160  13%
                         - pcomplete--here                        593   7%
                          - file-truename                         590   6%
                           - file-truename                        543   6%
                            - file-truename                       455   5%
                             - file-truename                      409   4%
                              - file-truename                     355   4%
                               - file-truename                    281   3%
                                - file-truename                   213   2%
                                 - file-truename                  186   2%
                                  - file-truename                 149   1%
                                   - file-truename                109   1%
                                    - file-truename                 67   0%
                                       file-truename                 25   0%
                         + while                                  564   6%
                        + pcomplete-parse-arguments                 25   0%
                        + org-command-at-point                     18   0%
                       + mapcar                                   283   3%
                       + comint--unquote-argument                   7   0%
                         pcomplete--common-suffix                   7   0%
            + derived-mode-p                                        4   0%
    + company--fetch-candidates                                     3   0%
  + company-call-frontends                                         16   0%
 + company-call-frontends                                          90   1%
- ...                                                            1451  17%
 - company-auto-begin                                             954  11%
  - company--perform                                              954  11%
   - company--begin-new                                           954  11%
    - company-call-backend                                        941  11%
     - company--force-sync                                        941  11%
      - apply                                                     941  11%
       - company-call-backend-raw                                 941  11%
        - apply                                                   941  11%
         - company-capf                                           941  11%
          - company--capf-data                                    938  11%
           - company--capf-data-real                              938  11%
            - run-hook-wrapped                                    938  11%
             - completion--capf-wrapper                           938  11%
              - pcomplete-completions-at-point                    938  11%
               - mapcar                                           938  11%
                - #<compiled 0xabea9a9>                           938  11%
                 - file-truename                                  938  11%
                  - file-truename                                 932  11%
                   - file-truename                                929  10%
                    - file-truename                               782   9%
                     - file-truename                              648   7%
                      - file-truename                             542   6%
                       - file-truename                            446   5%
                        - file-truename                           347   4%
                         - file-truename                          264   3%
                          - file-truename                         163   1%
                           - file-truename                         86   1%
                              file-truename                        27   0%
          + company--capf-post-completion                           3   0%
    + company-calculate-candidates                                 13   0%
   Automatic GC                                                   497   5%
+ timer-event-handler                                             508   6%
+ redisplay_internal (C function)                                  83   0%

[-- Attachment #3: profiler-memory.txt --]
[-- Type: text/plain, Size: 9231 bytes --]

- company-post-command                                    305,110,567  73%
 - company--perform                                       304,349,811  72%
  - company--continue                                     302,923,670  72%
   - company-calculate-candidates                         201,401,680  48%
    - company--postprocess-candidates                     199,844,422  47%
     - company--transform-candidates                      199,844,422  47%
      - company-sort-by-occurrence                        199,844,422  47%
       - cl-delete-if                                     199,840,286  47%
        - apply                                           199,840,286  47%
         - cl-delete                                      199,840,286  47%
          - #<compiled 0xc59de51>                         199,840,286  47%
           - company--occurrence-predicate                199,836,150  47%
            - company-call-backend                        199,836,150  47%
             - company--force-sync                        199,836,150  47%
              - apply                                     199,836,150  47%
               - company-call-backend-raw                 199,836,150  47%
                - apply                                   199,836,150  47%
                 - company-capf                           199,836,150  47%
                  - company--capf-data                    199,831,958  47%
                   - company--capf-data-real              199,831,958  47%
                    - run-hook-wrapped                    199,815,414  47%
                     - completion--capf-wrapper           199,815,414  47%
                      - pcomplete-completions-at-point    199,786,614  47%
                       + mapcar                           100,343,364  24%
                       - pcomplete-completions             99,171,770  23%
                        - pcomplete/org-mode/block-option/src    99,010,502  23%
                         - while                           81,666,454  19%
                          - pcomplete--here                81,666,454  19%
                           - file-truename                 81,659,118  19%
                            - file-truename                63,667,594  15%
                             + file-truename               43,576,958  10%
                         - pcomplete--here                 17,344,048   4%
                            file-truename                  17,245,596   4%
                        + pcomplete-parse-arguments           116,924   0%
                        + org-command-at-point                 40,152   0%
                         completion-table-with-quoting         49,632   0%
                         completion-table-subvert              45,496   0%
                       + comint--unquote-argument              27,720   0%
                         pcomplete--common-suffix               4,096   0%
    + company--fetch-candidates                             1,557,258   0%
   - company-call-backend                                 101,521,990  24%
    - company--force-sync                                 101,521,990  24%
     - apply                                              101,521,990  24%
      - company-call-backend-raw                          101,521,990  24%
       - apply                                            101,521,990  24%
        - company-capf                                    101,521,990  24%
         - company--capf-data                             101,521,990  24%
          - company--capf-data-real                       101,521,990  24%
           - run-hook-wrapped                             101,521,990  24%
            - completion--capf-wrapper                    101,521,990  24%
             - pcomplete-completions-at-point             101,521,990  24%
              - mapcar                                     56,819,836  13%
               - #<compiled 0xabea9a9>                     56,819,836  13%
                - file-truename                            56,789,116  13%
                 - file-truename                           56,387,986  13%
                  - file-truename                          56,108,958  13%
                   - file-truename                         46,490,968  11%
                    - file-truename                        37,198,576   8%
                     - file-truename                       27,718,886   6%
                      - file-truename                      18,284,816   4%
                         file-truename                      9,083,978   2%
              - pcomplete-completions                      44,694,946  10%
               - pcomplete/org-mode/block-option/src       44,694,946  10%
                - pcomplete--here                          44,694,946  10%
                 - file-truename                           44,694,946  10%
                  - file-truename                          44,422,884  10%
                   - file-truename                         23,766,500   5%
                    - file-truename                        18,916,088   4%
                     - file-truename                       14,263,716   3%
                      - file-truename                       9,433,980   2%
                         file-truename                      4,710,460   1%
                completion-table-with-quoting                   4,136   0%
              - comint--unquote-argument                        3,072   0%
                 comint--unquote&requote-argument               3,072   0%
  + company-call-frontends                                  1,426,141   0%
 + company-call-frontends                                     760,756   0%
- command-execute                                         101,160,160  24%
 - call-interactively                                     101,160,160  24%
  - funcall-interactively                                 101,160,160  24%
   - company-complete-selection                            53,635,376  12%
    - company-finish                                       53,635,376  12%
     - company-cancel                                      53,632,280  12%
      - company-call-backend                               53,623,992  12%
       - company--force-sync                               53,623,992  12%
        - apply                                            53,623,992  12%
         - company-call-backend-raw                        53,623,992  12%
          - apply                                          53,623,992  12%
           - company-capf                                  53,623,992  12%
            - company--capf-post-completion                53,623,992  12%
             - company--capf-data                          53,623,992  12%
              - company--capf-data-real                    53,623,992  12%
               - run-hook-wrapped                          53,623,992  12%
                - completion--capf-wrapper                 53,623,992  12%
                 - pcomplete-completions-at-point          53,623,992  12%
                  - mapcar                                 32,465,144   7%
                   - #<compiled 0xabea9a9>                 32,465,144   7%
                    - file-truename                        32,454,904   7%
                     - file-truename                       32,321,194   7%
                      - file-truename                      32,228,534   7%
                       - file-truename                     32,205,548   7%
                        - file-truename                    32,184,684   7%
                         - file-truename                   32,163,846   7%
                          - file-truename                  32,143,068   7%
                           - file-truename                 32,121,310   7%
                            - file-truename                32,092,476   7%
                             - file-truename               22,937,860   5%
                              + file-truename              13,578,400   3%
                  + pcomplete-completions                  21,157,824   5%
                  + comint--unquote-argument                    1,024   0%
      + run-hook-with-args                                      8,288   0%
     + company--insert-candidate                                3,096   0%
   + counsel-M-x                                           41,932,566  10%
   + save-buffer                                            5,471,224   1%
   + org-self-insert-command                                   75,512   0%
   + org-kill-line                                             45,482   0%
+ redisplay_internal (C function)                           5,544,422   1%
+ timer-event-handler                                       5,009,470   1%
+ yas--post-command-handler                                   107,984   0%
+ winner-save-old-configurations                               12,408   0%
  beacon--vanish                                                8,192   0%
+ xselect-convert-to-string                                     2,176   0%
+ sclang-document-post-command-hook-function                    2,048   0%
  ...                                                               0   0%

[-- Attachment #4: Type: text/plain, Size: 187 bytes --]


--
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

                 reply	other threads:[~2018-05-05  9:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7teifuu.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).