emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it possible to optimize Org Mode org-activate-links ?


From: Christopher Miles
Subject: Is it possible to optimize Org Mode org-activate-links ?
Date: Sat, 13 Feb 2021 01:10:28 +0000

<#secure method=pgpmime mode=sign>

I did an profiler (with my extension "org-link-beautify").

Here is the result of (Memory and CPU).

I checked org-element-context source code, it's not so long and complex. Why it caused so many items in Memory profiler result? Is it possible to optimize it?

Here is the Emacs profiler (CPU) result:

8   2%          - org-activate-links
8   2%           - catch
8   2%            - while
6   2%             - let*
6   2%              - if
6   2%               - progn
6   2%                - let*
5   1%                 - let
5   1%                  - if
5   1%                   - progn
5   1%                    - funcall
5   1%                     - org-link-beautify-display
2   0%                      - org-link-beautify--return-icon
2   0%                         org-link-beautify--warning
2   0%                        file-name-extension
1   0%                      - org-link-beautify--preview-pdf
1   0%                       - org-link-beautify--display-thumbnail
1   0%                        - create-image
1   0%                         - apply
1   0%                          - #<compiled 0x4c76891e673d173>
1   0%                           - image-type
1   0%                            - image-type-from-file-header
1   0%                               generate-new-buffer
1   0%                 - let*
1   0%                  - cond
1   0%                   - or
1   0%                      facep

Here is the Emacs profiler (Memory) result:

1,939,896  11%          - org-activate-links
1,939,896  11%           - catch
1,939,896  11%            - while
1,761,816  10%             - let*
1,761,816  10%              - if
1,697,400   9%               - progn
1,658,488   9%                - let*
1,511,048   8%                 - let
1,511,048   8%                  - if
1,511,048   8%                   - progn
1,511,048   8%                    - funcall
1,511,048   8%                     - org-link-beautify-display
  947,000   5%                      - org-link-beautify--get-element
  947,000   5%                       - org-element-context
  947,000   5%                        - catch
  947,000   5%                         - save-excursion
  947,000   5%                          - save-restriction
  947,000   5%                           - let*
  792,384   4%                            - let
  792,384   4%                             - catch
  792,384   4%                              - while
  792,384   4%                               - let
  792,384   4%                                - org-element--object-lex
  792,384   4%                                 - if
  792,384   4%                                  - let*
  792,384   4%                                   - save-excursion
  792,384   4%                                    - while
  661,368   3%                                     - let
  655,272   3%                                      - setq
  655,272   3%                                       - cond
  655,272   3%                                        - let*
  655,272   3%                                         - cond
  610,224   3%                                          - let*
  610,224   3%                                           - cond
  610,224   3%                                            - if
  610,224   3%                                             - progn
  610,224   3%                                              - org-element-link-parser
  610,224   3%                                               - catch
  610,224   3%                                                - let
  450,480   2%                                                 - cond
  225,240   1%                                                  - setq
  225,240   1%                                                   - org-link-expand-abbrev
  139,248   0%                                                    - org-link-unescape
  131,064   0%                                                     - replace-regexp-in-string
    8,184   0%                                                        apply
   85,992   0%                                                    - if
   77,808   0%                                                       not
    8,184   0%                                                     - let*
    8,184   0%                                                        and
  163,800   0%                                                  - cond
   61,440   0%                                                     or
    8,184   0%                                                     setq
  159,744   0%                                                 - if
   98,304   0%                                                  - progn
   49,152   0%                                                     if
   49,152   0%                                                   - setq
   49,152   0%                                                      replace-regexp-in-string
   45,048   0%                                          - and
   45,048   0%                                           - org-element-link-parser
   45,048   0%                                            - catch
   45,048   0%                                             - let
   32,760   0%                                                cond
   12,288   0%                                                if
  131,016   0%                                       and
  154,616   0%                            - or
  154,616   0%                             - org-element-at-point
  154,616   0%                              - save-excursion
  154,616   0%                               - save-restriction
  154,616   0%                                - let
  154,616   0%                                 - cond
   79,864   0%                                  - progn
   79,864   0%                                   - let*
   71,680   0%                                    - org-at-heading-p
   71,680   0%                                       outline-on-heading-p
   74,752   0%                                  - org-element--parse-to
   74,752   0%                                   - catch
   74,752   0%                                    - save-excursion
   74,752   0%                                     - save-restriction
   74,752   0%                                      - let*
   74,752   0%                                       - cond
   74,752   0%                                        - if
   74,752   0%                                         - progn
   74,752   0%                                          - let*
   74,752   0%                                             outline-previous-heading
  368,568   2%                      - file-name-extension
   36,864   0%                         file-name-sans-versions
  133,272   0%                      - org-link-beautify--preview-pdf
  109,788   0%                       - org-link-beautify--display-thumbnail
  107,898   0%                        - create-image
  107,898   0%                         - apply
  107,898   0%                          - #<compiled 0x4c76891e673d173>
  107,898   0%                           - image-type
  107,898   0%                            - image-type-from-file-header
   63,048   0%                               insert-file-contents-literally
   32,760   0%                               image-type-from-buffer
      126   0%                               generate-new-buffer
   22,512   0%                      - org-link-unescape
   22,512   0%                       - replace-regexp-in-string
   16,368   0%                          apply
   22,352   0%                        org-link-beautify--display-icon
    9,216   0%                      - org-link-beautify--return-icon
    8,184   0%                         org-link-beautify--warning
  139,256   0%                 - save-excursion
  139,256   0%                  - let
  139,256   0%                   - unwind-protect
  139,256   0%                    - progn
  139,256   0%                     - org-element-link-parser
  139,256   0%                      - catch
  139,256   0%                       - let
  103,416   0%                        - cond
   50,168   0%                         - setq
   50,168   0%                          - org-link-expand-abbrev
   34,808   0%                           - org-link-unescape
   26,624   0%                              replace-regexp-in-string
   15,360   0%                           - if
   15,360   0%                              not
   30,720   0%                         - cond
   15,360   0%                            or
   35,840   0%                        - if
   18,432   0%                         - progn
    9,216   0%                            if
    9,216   0%                          - setq
    9,216   0%                             replace-regexp-in-string
    8,184   0%                 - list
    8,184   0%                  - let*
    8,184   0%                     if
   38,912   0%                - let
   38,912   0%                 + let*
   64,416   0%               + and

Attachment: ATT00001.txt
Description: ATT00001.txt


reply via email to

[Prev in Thread] Current Thread [Next in Thread]