kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo
https://ox-hugo.scripter.co
GNU General Public License v3.0
885 stars 132 forks source link

Slow autosave export #665

Closed RagnarGrootKoerkamp closed 2 years ago

RagnarGrootKoerkamp commented 2 years ago

Actual Behavior

The automatic export after saving a ~200line org file takes around 3 seconds.

Expected Behavior

Building/exporting all ~15 files in my blog from the command line using this function takes around 6 seconds, and exporting this particular file does not seem to take more than maybe 0.3 seconds.

How to Reproduce the Issue

Example Org File

here

It contains some jpg images, some svg images, and a few tables. Removing those does not consistently make the export faster. On the other hand, removing the Proof section containing a lot of latex does seem to make things faster.

CPU-profiler report

From the CPU profile it seems that indeed most of the time is spent on exporting latex. That in itself is not too surprising, but the question is why this is so much slower than the standalone export. Could it be some of my settings that make the autosave version much slower?

CPU Profile 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% - # 7305 92% - apply 7305 92% - +org--dont-trigger-save-hooks-a 7305 92% - let 7305 92% - apply 7305 92% - # 7301 92% - org-export-as 7301 92% - apply 7301 92% - +org--fix-async-export-a 7301 92% - let 7298 92% - apply 7298 92% - # 6991 88% - org-export-data 6991 88% - mapconcat 6991 88% - # 6991 88% - org-export-data 6987 88% - mapconcat 6987 88% - # 6983 88% - org-export-data 6977 88% - mapconcat 6977 88% - # 6977 88% - org-export-data 6971 88% - mapconcat 6971 88% - # 6971 88% - org-export-data 6775 86% - mapconcat 6775 86% - # 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% - # 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% # 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% + # 3 0% + let 2 0% + write-file 2 0% # 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

Ox-Hugo Debug Information

Debug Info # Debug information for `ox-hugo` ## Emacs Version GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) of 2022-05-18 (commit 3ddccb531ded81fd81e76494d043323d5785db8f) ## Org Version Org mode version 9.6 (9.6-??-00adad935 @ /home/philae/.config/emacs/.local/straight/build-28.1.50/org/) ## Hugo Version hugo v0.101.0+extended linux/amd64 BuildDate=unknown ### Org `load-path` shadows **Warning**: Possible mixed installation of Org /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-datetree hides /usr/share/emacs/28.1.50/lisp/org/org-datetree /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-latex hides /usr/share/emacs/28.1.50/lisp/org/ox-latex /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-processing hides /usr/share/emacs/28.1.50/lisp/org/ob-processing /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-ctags hides /usr/share/emacs/28.1.50/lisp/org/org-ctags /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-odt hides /usr/share/emacs/28.1.50/lisp/org/ox-odt /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-gnuplot hides /usr/share/emacs/28.1.50/lisp/org/ob-gnuplot /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-scheme hides /usr/share/emacs/28.1.50/lisp/org/ob-scheme /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-beamer hides /usr/share/emacs/28.1.50/lisp/org/ox-beamer /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-java hides /usr/share/emacs/28.1.50/lisp/org/ob-java /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-lisp hides /usr/share/emacs/28.1.50/lisp/org/ob-lisp /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-groovy hides /usr/share/emacs/28.1.50/lisp/org/ob-groovy /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-ref hides /usr/share/emacs/28.1.50/lisp/org/ob-ref /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-colview hides /usr/share/emacs/28.1.50/lisp/org/org-colview /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-matlab hides /usr/share/emacs/28.1.50/lisp/org/ob-matlab /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-archive hides /usr/share/emacs/28.1.50/lisp/org/org-archive /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-eval hides /usr/share/emacs/28.1.50/lisp/org/ob-eval /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-ditaa hides /usr/share/emacs/28.1.50/lisp/org/ob-ditaa /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox hides /usr/share/emacs/28.1.50/lisp/org/ox /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-ruby hides /usr/share/emacs/28.1.50/lisp/org/ob-ruby /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-compat hides /usr/share/emacs/28.1.50/lisp/org/org-compat /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-bbdb hides /usr/share/emacs/28.1.50/lisp/org/ol-bbdb /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-timer hides /usr/share/emacs/28.1.50/lisp/org/org-timer /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-lilypond hides /usr/share/emacs/28.1.50/lisp/org/ob-lilypond /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-icalendar hides /usr/share/emacs/28.1.50/lisp/org/ox-icalendar /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-man hides /usr/share/emacs/28.1.50/lisp/org/ox-man /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-table hides /usr/share/emacs/28.1.50/lisp/org/ob-table /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-id hides /usr/share/emacs/28.1.50/lisp/org/org-id /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-capture hides /usr/share/emacs/28.1.50/lisp/org/org-capture /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-attach-git hides /usr/share/emacs/28.1.50/lisp/org/org-attach-git /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-sql hides /usr/share/emacs/28.1.50/lisp/org/ob-sql /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-irc hides /usr/share/emacs/28.1.50/lisp/org/ol-irc /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-feed hides /usr/share/emacs/28.1.50/lisp/org/org-feed /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-doi hides /usr/share/emacs/28.1.50/lisp/org/ol-doi /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-ocaml hides /usr/share/emacs/28.1.50/lisp/org/ob-ocaml /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol hides /usr/share/emacs/28.1.50/lisp/org/ol /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-org hides /usr/share/emacs/28.1.50/lisp/org/ox-org /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-src hides /usr/share/emacs/28.1.50/lisp/org/org-src /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-awk hides /usr/share/emacs/28.1.50/lisp/org/ob-awk /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-list hides /usr/share/emacs/28.1.50/lisp/org/org-list /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-comint hides /usr/share/emacs/28.1.50/lisp/org/ob-comint /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-haskell hides /usr/share/emacs/28.1.50/lisp/org/ob-haskell /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-goto hides /usr/share/emacs/28.1.50/lisp/org/org-goto /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-sqlite hides /usr/share/emacs/28.1.50/lisp/org/ob-sqlite /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-python hides /usr/share/emacs/28.1.50/lisp/org/ob-python /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-fortran hides /usr/share/emacs/28.1.50/lisp/org/ob-fortran /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-lint hides /usr/share/emacs/28.1.50/lisp/org/org-lint /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-eshell hides /usr/share/emacs/28.1.50/lisp/org/ob-eshell /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-inlinetask hides /usr/share/emacs/28.1.50/lisp/org/org-inlinetask /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-docview hides /usr/share/emacs/28.1.50/lisp/org/ol-docview /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-habit hides /usr/share/emacs/28.1.50/lisp/org/org-habit /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-macro hides /usr/share/emacs/28.1.50/lisp/org/org-macro /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-num hides /usr/share/emacs/28.1.50/lisp/org/org-num /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-sass hides /usr/share/emacs/28.1.50/lisp/org/ob-sass /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-gnus hides /usr/share/emacs/28.1.50/lisp/org/ol-gnus /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-mobile hides /usr/share/emacs/28.1.50/lisp/org/org-mobile /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-octave hides /usr/share/emacs/28.1.50/lisp/org/ob-octave /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-julia hides /usr/share/emacs/28.1.50/lisp/org/ob-julia /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-element hides /usr/share/emacs/28.1.50/lisp/org/org-element /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-protocol hides /usr/share/emacs/28.1.50/lisp/org/org-protocol /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-koma-letter hides /usr/share/emacs/28.1.50/lisp/org/ox-koma-letter /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-keys hides /usr/share/emacs/28.1.50/lisp/org/org-keys /home/philae/.config/emacs/.local/straight/build-28.1.50/org/oc-biblatex hides /usr/share/emacs/28.1.50/lisp/org/oc-biblatex /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-perl hides /usr/share/emacs/28.1.50/lisp/org/ob-perl /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-C hides /usr/share/emacs/28.1.50/lisp/org/ob-C /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-texinfo hides /usr/share/emacs/28.1.50/lisp/org/ox-texinfo /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-clock hides /usr/share/emacs/28.1.50/lisp/org/org-clock /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-tempo hides /usr/share/emacs/28.1.50/lisp/org/org-tempo /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-crypt hides /usr/share/emacs/28.1.50/lisp/org/org-crypt /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-indent hides /usr/share/emacs/28.1.50/lisp/org/org-indent /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-emacs-lisp hides /usr/share/emacs/28.1.50/lisp/org/ob-emacs-lisp /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-md hides /usr/share/emacs/28.1.50/lisp/org/ox-md /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-plantuml hides /usr/share/emacs/28.1.50/lisp/org/ob-plantuml /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-forth hides /usr/share/emacs/28.1.50/lisp/org/ob-forth /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-css hides /usr/share/emacs/28.1.50/lisp/org/ob-css /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-sed hides /usr/share/emacs/28.1.50/lisp/org/ob-sed /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-org hides /usr/share/emacs/28.1.50/lisp/org/ob-org /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-faces hides /usr/share/emacs/28.1.50/lisp/org/org-faces /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-html hides /usr/share/emacs/28.1.50/lisp/org/ox-html /home/philae/.config/emacs/.local/straight/build-28.1.50/org/oc-basic hides /usr/share/emacs/28.1.50/lisp/org/oc-basic /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-entities hides /usr/share/emacs/28.1.50/lisp/org/org-entities /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-lua hides /usr/share/emacs/28.1.50/lisp/org/ob-lua /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-w3m hides /usr/share/emacs/28.1.50/lisp/org/ol-w3m /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-maxima hides /usr/share/emacs/28.1.50/lisp/org/ob-maxima /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-tangle hides /usr/share/emacs/28.1.50/lisp/org/ob-tangle /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-latex hides /usr/share/emacs/28.1.50/lisp/org/ob-latex /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-refile hides /usr/share/emacs/28.1.50/lisp/org/org-refile /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-table hides /usr/share/emacs/28.1.50/lisp/org/org-table /home/philae/.config/emacs/.local/straight/build-28.1.50/org/oc hides /usr/share/emacs/28.1.50/lisp/org/oc /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-pcomplete hides /usr/share/emacs/28.1.50/lisp/org/org-pcomplete /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-version hides /usr/share/emacs/28.1.50/lisp/org/org-version /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-calc hides /usr/share/emacs/28.1.50/lisp/org/ob-calc /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-man hides /usr/share/emacs/28.1.50/lisp/org/ol-man /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-agenda hides /usr/share/emacs/28.1.50/lisp/org/org-agenda /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-footnote hides /usr/share/emacs/28.1.50/lisp/org/org-footnote /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob hides /usr/share/emacs/28.1.50/lisp/org/ob /home/philae/.config/emacs/.local/straight/build-28.1.50/org/oc-csl hides /usr/share/emacs/28.1.50/lisp/org/oc-csl /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-mouse hides /usr/share/emacs/28.1.50/lisp/org/org-mouse /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-screen hides /usr/share/emacs/28.1.50/lisp/org/ob-screen /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-ascii hides /usr/share/emacs/28.1.50/lisp/org/ox-ascii /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-core hides /usr/share/emacs/28.1.50/lisp/org/ob-core /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org hides /usr/share/emacs/28.1.50/lisp/org/org /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-bibtex hides /usr/share/emacs/28.1.50/lisp/org/ol-bibtex /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-macs hides /usr/share/emacs/28.1.50/lisp/org/org-macs /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-exp hides /usr/share/emacs/28.1.50/lisp/org/ob-exp /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-lob hides /usr/share/emacs/28.1.50/lisp/org/ob-lob /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-mhe hides /usr/share/emacs/28.1.50/lisp/org/ol-mhe /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-duration hides /usr/share/emacs/28.1.50/lisp/org/org-duration /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-makefile hides /usr/share/emacs/28.1.50/lisp/org/ob-makefile /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-info hides /usr/share/emacs/28.1.50/lisp/org/ol-info /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-R hides /usr/share/emacs/28.1.50/lisp/org/ob-R /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-eww hides /usr/share/emacs/28.1.50/lisp/org/ol-eww /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-loaddefs hides /usr/share/emacs/28.1.50/lisp/org/org-loaddefs /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ox-publish hides /usr/share/emacs/28.1.50/lisp/org/ox-publish /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-eshell hides /usr/share/emacs/28.1.50/lisp/org/ol-eshell /home/philae/.config/emacs/.local/straight/build-28.1.50/org/oc-natbib hides /usr/share/emacs/28.1.50/lisp/org/oc-natbib /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-clojure hides /usr/share/emacs/28.1.50/lisp/org/ob-clojure /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ol-rmail hides /usr/share/emacs/28.1.50/lisp/org/ol-rmail /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-attach hides /usr/share/emacs/28.1.50/lisp/org/org-attach /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-shell hides /usr/share/emacs/28.1.50/lisp/org/ob-shell /home/philae/.config/emacs/.local/straight/build-28.1.50/org/org-plot hides /usr/share/emacs/28.1.50/lisp/org/org-plot /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-dot hides /usr/share/emacs/28.1.50/lisp/org/ob-dot /home/philae/.config/emacs/.local/straight/build-28.1.50/org/ob-js hides /usr/share/emacs/28.1.50/lisp/org/ob-js Study the output of `M-x list-load-path-shadows`. ## `ox-hugo` defcustoms
org-hugo-section “posts”
org-hugo-use-code-for-kbd nil
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format “toml”
org-hugo-default-static-subdirectory-for-externals “ox-hugo”
org-hugo-external-file-extensions-allowed-for-copying (“jpg” “jpeg” “tiff” “png” “svg” “gif” “mp4” “pdf” “odt” “doc” “ppt” “xls” “docx” “pptx” “xlsx”)
org-hugo-date-format “%Y-%m-%dT%T%z”
org-hugo-paired-shortcodes “”
org-hugo-langs-no-descr-in-code-fences nil
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format “toml”
kaushalmodi commented 2 years ago

You seem to be using the Org version built from its repo's main branch. So it could be related to https://github.com/kaushalmodi/ox-hugo/discussions/551.

Does the export speed up after you evaluate (setq org-element-use-cache nil)?

RagnarGrootKoerkamp commented 2 years ago

Disabling the cache seems to make things slightly better on average indeed, but I think still not as fast at it once was. I'll follow #551 and see where things go.

kaushalmodi commented 2 years ago

Disabling the cache seems to make things slightly better on average indeed, but I think still not as fast at it once was.

ox-hugo mainly uses org-html-format-latex from ox-html as you see in your profile report. Even then, that doesn't look like the main culprit. 68% time is spent in org-html-format-latex, but 57% chunk is spent in run-hooks. Can you disable all those minor modes globally and see if things get faster?

 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

Also, does using the stable version of Org mode make the export faster? Install the Org mode from GNU Elpa to get the stable version, or build Org mode from the git bugfix branch.

RagnarGrootKoerkamp commented 2 years ago

Oh wow, changing from main to bugfix completely fixed the problem! It's almost instant again now (around 0.2s I'd say) :smile:

Disabling the org-element-cache isn't needed anymore with this.

Thanks! Writing is much more joyful again now :)

kaushalmodi commented 2 years ago

I'd appreciate if you can write an email about performance difference between bugfix and main on the Org mode mailing list.

Thanks!

kaushalmodi commented 2 years ago

In that email, would you be able to share the cpu profiles when exporting using both Org versions?

RagnarGrootKoerkamp commented 2 years ago

done! https://lists.gnu.org/archive/html/emacs-orgmode/2022-08/msg00316.html