emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bad save performance on `main` branch
@ 2022-08-15 21:10 Ragnar Groot Koerkamp
  2022-08-15 23:08 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Ragnar Groot Koerkamp @ 2022-08-15 21:10 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

I ran into an issue [1] [2] with ox-hugo where exporting an org file on
auto-save takes very long (3+ seconds) compared to ~0.2s normally. This is
using commit 00adad935 on the main branch from a few days back (using
Doom). See below for a cpu profile.

After switching back to the bugfix branch (6e991f4bb), the auto-save is
fast again. Again see the cpu profile below.

Steps to reproduce are already in [1], but I hope the profiles below should
give a start at finding the cause of this issue.

Thanks!

1: https://github.com/kaushalmodi/ox-hugo/issues/665
2: https://github.com/kaushalmodi/ox-hugo/discussions/551

Slow ~3s export on branch main (00adad935):

  7354  93% - command-execute
  7354  93%  - funcall-interactively
  7354  93%   - save-buffer
  7354  93%    - basic-save-buffer
  7349  93%     - run-hooks
  7323  93%      - org-hugo-export-wim-to-md-after-save
  7323  93%       - org-hugo-export-wim-to-md
  7321  93%        - org-hugo--export-file-to-md
  7318  93%         - org-hugo-export-to-md
  7314  92%          - org-export-to-file
  7314  92%           - apply
  7305  92%            - +org--fix-async-export-a
  7305  92%             - let
  7305  92%              - apply
  7305  92%               - #<compiled -0x18adb202b7f79385>
  7305  92%                - apply
  7305  92%                 - +org--dont-trigger-save-hooks-a
  7305  92%                  - let
  7305  92%                   - apply
  7305  92%                    - #<compiled 0x1dde7d5b13500726>
  7301  92%                     - org-export-as
  7301  92%                      - apply
  7301  92%                       - +org--fix-async-export-a
  7301  92%                        - let
  7298  92%                         - apply
  7298  92%                          - #<compiled 0x1b319a47596dd1a2>
  6991  88%                           - org-export-data
  6991  88%                            - mapconcat
  6991  88%                             - #<compiled 0x61ea8f62f7d4cf2>
  6991  88%                              - org-export-data
  6987  88%                               - mapconcat
  6987  88%                                - #<compiled 0x61ea8f62f7d4cf2>
  6983  88%                                 - org-export-data
  6977  88%                                  - mapconcat
  6977  88%                                   - #<compiled
0x61ea8f62f7d4cf2>
  6977  88%                                    - org-export-data
  6971  88%                                     - mapconcat
  6971  88%                                      - #<compiled
0x61ea8f62f7d4cf2>
  6971  88%                                       - org-export-data
  6775  86%                                        - mapconcat
  6775  86%                                         - #<compiled
0x61ea8f62f7d4cf2>
  6775  86%                                          - org-export-data
  5356  68%                                           -
org-blackfriday-latex-fragment
  5354  68%                                            -
org-html-format-latex
  5321  67%                                             -
org-export-copy-buffer
  5039  64%                                              - #<compiled
0x282f7cab5f98f9e>
  4994  63%                                               - org-mode
  4499  57%                                                - run-mode-hooks
  4485  57%                                                 - run-hooks
  1777  22%                                                  +
global-flycheck-mode-enable-in-buffers
   939  11%                                                  +
global-emojify-mode-enable-in-buffers
   556   7%                                                  +
evil-mode-enable-in-buffers
   449   5%                                                  +
yas-global-mode-enable-in-buffers
   322   4%                                                  +
ws-butler-global-mode-enable-in-buffers
   254   3%                                                  +
global-company-mode-enable-in-buffers
   122   1%                                                  +
global-font-lock-mode-enable-in-buffers
    38   0%                                                  +
+format-enable-on-save-maybe-h
     7   0%                                                  +
global-undo-fu-session-mode-enable-in-buffers
     6   0%                                                  +
global-anzu-mode-enable-in-buffers
     6   0%                                                  +
global-evil-surround-mode-enable-in-buffers
     3   0%                                                  +
evil-snipe-override-mode-enable-in-buffers
    14   0%                                                 + apply
   157   1%                                                + outline-mode
   123   1%                                                +
org-fold-initialize
    96   1%                                                +
org-element-cache-reset
    49   0%                                                + add-hook
    36   0%                                                +
org-install-agenda-files-menu
    13   0%                                                +
org-set-regexps-and-options
     7   0%                                                +
org-macro-initialize-templates
     4   0%
 set-face-foreground
     3   0%                                                +
org-persist-load
    45   0%                                               +
org-element-cache-reset
   244   3%
 org-export--generate-copy-script
     5   0%                                              +
generate-new-buffer
    15   0%                                             + org-format-latex
    10   0%                                             + erase-buffer
     5   0%                                               #<compiled
0x13978e1a44134e5b>
     3   0%
jit-lock-after-change
     2   0%
 org-blackfriday-escape-chars-in-equation
  1087  13%                                           +
org-blackfriday-table-cell
   273   3%                                           +
org-blackfriday-latex-environment
    59   0%                                           + mapconcat
   192   2%                                        +
org-blackfriday-latex-fragment
     4   0%                                        + org-hugo-link
     4   0%
org-element-normalize-string
     2   0%                                     + org-hugo-link
     6   0%                                  + org-hugo-headline
     4   0%                                 org-element-normalize-string
   227   2%                           + org-export-copy-buffer
    52   0%                           + org-babel-exp-process-buffer
    10   0%                           + org-element-parse-buffer
     6   0%                           + org-cite-process-citations
     3   0%                           + org-hugo-inner-template
     3   0%                           + org-export-filter-apply-functions
     3   0%                           + #<compiled 0x13978042ddab4e5b>
     3   0%                         + let
     2   0%                     + write-file
     2   0%                       #<compiled -0x1c8d77422d9b9897>
     9   0%            + lsp--on-set-visited-file-name
     4   0%          + org-export-get-environment
     3   0%         + org-export-get-environment
     2   0%        + org-hugo--export-subtree-to-md
    22   0%      + undo-fu-session-save-safe
     4   0%      + org-encrypt-entries
     3   0%     + basic-save-buffer-1
     1   0%     + vc-before-save
     1   0%     + vc-after-save
   499   6% + ...
     4   0% + timer-event-handler
     4   0%   ws-butler-global-mode-check-buffers
     3   0%   evil-mode-check-buffers
     3   0%   solaire-global-mode-check-buffers
     1   0%   evil-repeat-pre-hook

Fast ~0.2s export on branch bugfix (6e991f4bb):

238 100% - command-execute
221  92%  - funcall-interactively
217  91%   - save-buffer
217  91%    - basic-save-buffer
203  85%     - run-hooks
159  66%      - org-hugo-export-wim-to-md-after-save
159  66%       - org-hugo-export-wim-to-md
143  60%        - org-id-update-id-locations
123  51%         - openwith-file-handler
123  51%          - apply
106  44%           - lsp--on-set-visited-file-name
106  44%            - apply
100  42%             - +org--dont-trigger-save-hooks-a
100  42%              - let
100  42%               - apply
100  42%                - #<subr org-export-to-file>
100  42%                 - org-export-as
100  42%                  - apply
100  42%                   - +org--fix-async-export-a
100  42%                    - let
 97  40%                     - apply
 81  34%                      - #<subr org-export-as>
 57  23%                       - org-export-data
 57  23%                        - mapconcat
 57  23%                         - #<compiled -0x27df9e1e45ba910>
 57  23%                          - org-export-data
 43  18%                           - mapconcat
 43  18%                            - #<compiled -0x27df9e1e45ba910>
 43  18%                             - org-export-data
 40  16%                              - mapconcat
 40  16%                               - #<compiled -0x27df9e1e45ba910>
 40  16%                                - org-export-data
 40  16%                                 - mapconcat
 40  16%                                  - #<compiled -0x27df9e1e45ba910>
 40  16%                                   - org-export-data
 40  16%                                    - mapconcat
 40  16%                                     - #<compiled
-0x27df9e1e45ba910>
 40  16%                                      - org-export-data
 22   9%                                       -
org-blackfriday-latex-fragment
 19   7%                                        - org-html-format-latex
 16   6%                                         - #<compiled
-0x1c8cd31a99a81897>
 13   5%                                          - kill-buffer
 13   5%                                           - #<compiled
-0x1ca79d0dde8bbf0b>
 13   5%                                            -
doom-buffer-frame-predicate
 13   5%                                             - or
 13   5%                                              - doom-real-buffer-p
 13   5%                                               - let*
 13   5%                                                - if
 13   5%                                                 - progn
 13   5%                                                  - and
 13   5%                                                   - or
  6   2%                                                    -
run-hook-with-args-until-success
  6   2%                                                     -
+magit-buffer-p
  6   2%
 save-current-buffer
  3   1%                                         - org-format-latex
  3   1%                                          + org-element-context
  3   1%
 org-blackfriday-escape-chars-in-equation
 14   5%                                       - org-hugo-link
  4   1%                                          url-encode-url
  3   1%                                        +
org-html-standalone-image-p
  3   1%                                        +
org-hugo--attachment-rewrite-maybe
  4   1%                                       + org-blackfriday-plain-text
  3   1%                                org-hugo-heading
  7   2%                           + org-blackfriday-table-cell
  4   1%                           + org-hugo-keyword
  3   1%                             org-hugo-heading
  7   2%                       + org-element-parse-buffer
  7   2%                       + org-cite-process-citations
  4   1%                       + org-hugo-inner-template
  3   1%                       + org-export-get-environment
  3   1%                       + org-export--prune-tree
 16   6%                      - #<compiled 0x154564ef426bd44>
 16   6%                       - apply
 16   6%                        - +org--dont-trigger-save-hooks-a
 16   6%                         - let
 16   6%                          - apply
 16   6%                           - #<subr org-export-to-file>
 16   6%                            - org-export-as
 16   6%                             - apply
 16   6%                              - +org--fix-async-export-a
 16   6%                               - let
 16   6%                                - apply
 16   6%                                 - #<subr org-export-as>
  7   2%                                  + org-babel-exp-process-buffer
  3   1%                                  + org-export-copy-buffer
  3   1%                                  + org-export-data
  3   1%                     + --first
  6   2%             + #<subr set-visited-file-name>
 17   7%           + insert-file-contents
 10   4%         + org-mode
  4   1%         + org-agenda-files
  3   1%           file-truename
 10   4%        + org-hugo--export-file-to-md
  6   2%        + org-hugo--buffer-has-valid-post-subtree-p
 40  16%      - undo-fu-session-save-safe
 40  16%       - undo-fu-session--save-impl
 17   7%        - undo-fu-session--encode
 13   5%         - undo-fu-session--walk-tree
  6   2%          - undo-fu-session--walk-tree
  3   1%           + undo-fu-session--walk-tree
  6   2%        - write-region
  6   2%         - jka-compr-handler
  6   2%          - apply
  6   2%           - jka-compr-write-region
  3   1%            - jka-compr-run-real-handler
  3   1%             + apply
  3   1%              jka-compr-call-process
  4   1%        + undo-fu-session--make-file-name
  3   1%          undo-fu-session--equivtable-encode
  4   1%      + flycheck-handle-save
  5   2%     + vc-before-save
  4   1%     + vc-after-save
  3   1%     + run-hook-with-args-until-success
  4   1%   + doom/toggle-profiler
 17   7%  + byte-code
  0   0% + ...

[-- Attachment #2: Type: text/html, Size: 18805 bytes --]

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

end of thread, other threads:[~2022-08-15 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15 21:10 Bad save performance on `main` branch Ragnar Groot Koerkamp
2022-08-15 23:08 ` Ihor Radchenko

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