I tried to find the reason in my LaTeX header uasge.
If I ban the usage of #+LATEX_HEADER: \usepackage{mathpazo}, the test time 
reduced to 3.5s. (I love this font set)
If I ban the fontenc + mathpazo, it remains 3.5s.
If I ban the lmodorn + fontenc + mathpazo, it reduces to 1.9s.
Other packages like tikz, geometry, stmaryrd do not affect the result time 
notably.
Maybe deleting my all newcommands and declareMathoperator (about 20 headers) 
will decrease the time more? But without them, I need to rewrite this org file 
to make the compilation successfully. So I haven't attempted it yet.
Yu Huang
---- Replied Message ----
FromYu Huang<hyto...@stu.pku.edu.cn>Date3/29/2025 12:56ToKarthik 
Chikmagalur<karthikchikmaga...@gmail.com>CcIhor Radchenko<yanta...@posteo.net>,
emacs-orgmode@gnu.org<emacs-orgmode@gnu.org>SubjectRe: org-persist-write:index 
takes minutes to run
the result of health-check is as follows.
I don't know why "Caching with org-persist" is ON. The value of 
`org-latex-preview-cache` is exactly "temp" now.
----------------------
Your LaTeX preview process
Precompile with latex -> LaTeX Compile with pdflatex -> Convert to SVG with 
dvisvgm
pdflatex
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)
/usr/bin/pdflatex
dvisvgm
dvisvgm 3.4.3
/usr/local/bin/dvisvgm
LaTeX preview options
• Precompilation ON
• Equation renumbering ON
• Caching with org-persist ON
LaTeX preview sizing
• Page width 0.8 (display equation width in LaTeX)
• Scale 1.50 (PNG pixel density multiplier)
• Zoom 1.00 (display scaling factor)
LaTeX preview preamble
\documentclass{article}
[DEFAULT-PACKAGES]
[PACKAGES]
\usepackage{xcolor}
Diagnostic info (copied)
(:image-converters
(("convert"
"Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org";
"/usr/bin/convert")
("dvisvgm" "dvisvgm 3.4.3" "/usr/local/bin/dvisvgm")
("dvipng" "This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson"
"/usr/bin/dvipng"))
:latex-processors
(("lualatex" "This is LuaHBTeX, Version 1.14.0 (TeX Live 2022/dev/Debian)"
"/usr/bin/lualatex")
("xelatex" "XeTeX 3.141592653-2.6-0.999993 (TeX Live 2022/dev/Debian)"
"/usr/bin/xelatex")
("pdflatex" "pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)"
"/usr/bin/pdflatex"))
:interactive t :org-version "9.8-pre" :modified
((org-persist-before-write-hook org-element--cache-persist-before-write)
(org-latex-preview-overlay-open-functions
org-latex-preview-live--ensure-overlay t)
(org-latex-preview-overlay-close-functions org-latex-preview-live--clearout t)
(org-latex-format-inlinetask-function
. org-latex-format-inlinetask-default-function)
(org-persist-after-read-hook org-element--cache-persist-after-read)
(org-latex-format-headline-function
. org-latex-format-headline-default-function)
(org-latex-format-drawer-function . #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"])
(org-latex-preview-appearance-options :foreground auto :background
"Transparent" :scale 1.5 :zoom 1.0
:page-width 0.8 :matchers
("begin" "$1" "$" "$$" "\\(" "\\["))
(org-latex-preview-process-finish-functions
org-latex-preview-live--record-hook t)
(org-latex-hyperref-template
. "\\usepackage[bookmarks=true, bookmarksopen=true, colorlinks=true, 
linkcolor=blue]{hyperref}\n\\hypersetup{\n pdfauthor={%a},\n pdftitle={%t},\n 
pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c},\n pdflang={%L}}\n")
(org-persist-directory . "/home/ycroaker/.emacs.d/.local/cache/org/persist/")
(org-latex-prefer-user-labels . t)
(org-latex-classes
("org-amsart-latex"
"\\documentclass[11pt,letter paper, oneside]{amsart}\n [NO-DEFAULT-PACKAGES]\n 
[PACKAGES]\n [EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(org-latex-preview-overlay-update-functions
org-latex-preview-live--update-overlay t)
(org-latex-preview-live-debounce . 0.25)
(org-latex-preview-process-alist
(dvipng :programs ("latex" "dvipng") :description "dvi > png" :message
"you need to install the programs: latex and dvipng."
:image-input-type "dvi" :image-output-type "png" :latex-compiler
("%l -interaction nonstopmode -output-directory %o %f")
:latex-precompiler
("%l -output-directory %o -ini -jobname=%b \"&%L\" mylatexformat.ltx %f")
:image-converter
("dvipng --follow -D %D -T tight --depth --height -o %B-%%09d.png %f")
:transparent-image-converter
("dvipng --follow -D %D -T tight -bg Transparent --depth --height -o 
%B-%%09d.png %f"))
(dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" :message
"you need to install the programs: latex and dvisvgm."
:image-input-type "dvi" :image-output-type "svg" :latex-compiler
("%l -interaction nonstopmode -output-directory %o %f")
:latex-precompiler
("%l -output-directory %o -ini -jobname=%b \"&%L\" mylatexformat.ltx %f")
:image-converter
("dvisvgm --page=1- --optimize --clipjoin --relative --no-fonts -v3 
--message='processing page {?pageno}: output written to {?svgpath}' 
--bbox=preview -o %B-%%9p.svg %f"))
(imagemagick :programs ("pdflatex" "convert") :description "pdf > png"
:message
"you need to install the programs: latex and imagemagick."
:image-input-type "pdf" :image-output-type "png" :latex-compiler
("pdflatex -interaction nonstopmode -output-directory %o %f")
:latex-precompiler
("pdftex -output-directory %o -ini -jobname=%b \"&pdflatex\" mylatexformat.ltx 
%f")
:image-converter
("convert -density %D -trim -antialias %f -quality 100 %B-%%09d.png")))
(org-latex-preview-live . t)
(org-persist-before-read-hook org-element--cache-persist-before-read)
(org-latex-preview-auto-ignored-commands next-line previous-line mwheel-scroll
scroll-up-command scroll-down-command)))
-------------------
Yu Huang
---- Replied Message ----
FromKarthik Chikmagalur<karthikchikmaga...@gmail.com>Date3/29/2025 12:48ToYu 
Huang<hyto...@stu.pku.edu.cn>CcIhor Radchenko<yanta...@posteo.net>,
emacs-orgmode@gnu.org<emacs-orgmode@gnu.org>SubjectRe: org-persist-write:index 
takes minutes to run
I am not kidding you in fact. 
In each test, I execute
#+begin_src elisp
(org-latex-preview-clear-cache)
(setq org-latex-preview-cache 'temp)
#+end_src
and compile \(\alpha\), after the precompilation hint vanishes, I
execute (my-org-latex-preview-benchmark), and the result is always
around 5.5s. I think this time is mistaken, since by my naked eyes,
the fragments around \(\alpha\) only take 0.5s-1s to be compiled and
shown.
5.5 seconds to compile 700 fragments without org-persist caching is a
really long time. I'm not sure what could be causing it. Can you
evaluate the code at this gist, then run M-x
org-latex-preview-check-health and supply the full output of this
command here?
https://gist.github.com/karthink/0ac48411a81459c0f3fd7557c4e817db
Karthik

Reply via email to