tecosaur / org-latex-preview-todos

A tracker for the Org LaTeX Preview effort on https://git.tecosaur.net/tec/org-mode
4 stars 0 forks source link

Every linked file is scanned during Precompilation #15

Open karthink opened 6 months ago

karthink commented 6 months ago

Precompilation/preamble generation causes every linked file be opened up and scanned. (Related to #2 and #13)

This severely slows down precompilation. Message I see when precompiling to preview a single fragment in an Org buffer with many links:

70 files scanned, 67 files contains IDs, and 1381 IDs found.

Backtrace:

A sane point to start investigating is probably org-export--collect-tree-properties, inside org-export--annotate-info.

* (org-id-find "e11394b5-da0c-4f63-8366-300ced2acecb")
  (#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_72> (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil (section ... #7)]) #2 #("\n" 0 1 (:parent #7)))] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #2))))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil (section ... #7)]) #2 #("\n" 0 1 (:parent #7)))] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #2))))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) ((link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil ...]) . #3)] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #4))) #("\n" 0 1 (:parent (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil (section ... #8)]) . #3)))))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil (section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil (headline ... #7)]) #2)]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #2] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #5))) #("\n" 0 1 (:parent #2))))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) ((paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil (section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil ...]) . #3)]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #4] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #7))) #("\n" 0 1 (:parent #4)))))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil (headline (:standard-properties [10862 10862 10921 11002 11002 0 (:title) nil nil nil nil 10923 11000 3 #<buffer do.org<2>> nil nil (headline ... ... #7)] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value (9 58) nil] :title (#("Thesis: Start an org document, LaTeX-ize it later" 0 49 ...)) :level 3 :priority nil :tags nil :todo-keyword "TODO" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil) #2)]) (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil #2]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #5] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #8))) #("\n" 0 1 (:parent #5)))))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) ((section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil (headline (:standard-properties [10862 10862 10921 11002 11002 0 ... nil nil nil nil 10923 11000 3 #<buffer do.org<2>> nil nil ...] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value ... nil] :title (...) :level 3 :priority nil :tags nil :todo-keyword "TODO" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil) . #3)]) (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil #4]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #7] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #10))) #("\n" 0 1 (:parent #7))))))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (headline (:standard-properties [10862 10862 10921 11002 11002 0 (:title) nil nil nil nil 10923 11000 3 #<buffer do.org<2>> nil nil (headline (:standard-properties [10687 10687 10760 11002 11002 0 (:title) nil nil nil nil 10860 11000 2 #<buffer do.org<2>> nil nil (headline ... ... ... ... ... ... ... #7 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value (11 72) nil] :title (#("Compile all research writing so far into a proto-d..." 0 61 ...)) :level 2 :priority nil :tags nil :todo-keyword "PROJECT" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil :CREATED [org-element-deferred org-element--substring (97 119) nil] :ID [org-element-deferred org-element--substring (131 167) nil]) (section (:standard-properties [10760 10760 10760 10862 10862 0 nil section nil nil nil 10760 10862 nil #<buffer do.org<2>> nil nil #7])) #2)] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value (9 58) nil] :title (#("Thesis: Start an org document, LaTeX-ize it later" 0 49 (:parent #2))) :level 3 :priority nil :tags nil :todo-keyword "TODO" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil) (section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil #2]) (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil #5]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #8] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #11))) #("\n" 0 1 (:parent #8))))))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) ((section (:standard-properties [10760 10760 10760 10862 10862 0 nil section nil nil nil 10760 10862 nil #<buffer do.org<2>> nil nil (headline (:standard-properties [10687 10687 10760 11002 11002 0 ... nil nil nil nil 10860 11000 2 #<buffer do.org<2>> nil nil ...] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value ... nil] :title (...) :level 2 :priority nil :tags nil :todo-keyword "PROJECT" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil :CREATED [org-element-deferred org-element--substring ... nil] :ID [org-element-deferred org-element--substring ... nil]) . #3)])) (headline (:standard-properties [10862 10862 10921 11002 11002 0 (:title) nil nil nil nil 10923 11000 3 #<buffer do.org<2>> nil nil (headline (:standard-properties [10687 10687 10760 11002 11002 0 ... nil nil nil nil 10860 11000 2 #<buffer do.org<2>> nil nil ...] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value ... nil] :title (...) :level 2 :priority nil :tags nil :todo-keyword "PROJECT" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil :CREATED [org-element-deferred org-element--substring ... nil] :ID [org-element-deferred org-element--substring ... nil]) . #3)] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value (9 58) nil] :title (#("Thesis: Start an org document, LaTeX-ize it later" 0 49 (:parent #5))) :level 3 :priority nil :tags nil :todo-keyword "TODO" :todo-type todo :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil) (section (:standard-properties [10921 10921 10921 11002 11002 0 nil section nil nil nil 10921 11002 nil #<buffer do.org<2>> nil nil #5]) (paragraph (:standard-properties [10921 10921 10921 11001 11002 1 nil planning nil nil nil nil nil nil #<buffer do.org<2>> nil nil #8]) (link (:standard-properties [10921 nil 10964 10998 11000 0 nil nil nil nil nil nil nil nil #<buffer do.org<2>> nil nil #11] :type "id" :type-explicit-p t :path "e11394b5-da0c-4f63-8366-300ced2acecb" :format bracket :raw-link "id:e11394b5-da0c-4f63-8366-300ced2acecb" :application nil :search-option nil) #("Control of Linear Periodic Systems" 0 34 (:parent #14))) #("\n" 0 1 (:parent #11)))))))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (headline ... ... ...))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (headline ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  (mapc #f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  (#f(compiled-function (--data) #<bytecode -0x15dd75e953770684>) (org-data ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  (org-element-ast-map (org-data ... ... ... ... ... ... ... ... ... ... ... ... ... ...) link #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_72> nil nil nil nil nil nil)
  (org-element-map (org-data ... ... ... ... ... ... ... ... ... ... ... ... ... ...) link #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_72>)
  (org-export--collect-tree-properties (org-data ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (:export-options nil :back-end ... :translate-alist ... :exported-data #<hash-table eq 0/4001 0x4b05ed7> :input-buffer "do.org" :input-file "/home/karthik/..." :time-stamp-file t ...))
  (org-export--annotate-info #s(org-export-backend :name latex :parent nil :transcoders (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :options (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :filters (... ... ... ...) :blocks nil :menu (108 "Export to LaTeX" ...) :feature-conditions (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :feature-implementations (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) (:export-options nil :back-end #s(org-export-backend :name latex :parent nil :transcoders ... :options ... :filters ... :blocks nil :menu ... :feature-conditions ... :feature-implementations ...) :translate-alist (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :exported-data #<hash-table eq 0/4001 0x4b05ed7> :input-buffer "do.org" :input-file "/home/karthik/Docume..." :time-stamp-file nil))
  (org-latex-preview--get-preamble)
  (org-latex-preview-place dvisvgm ((3461 3573 "\\[\n\\frac{\\left| \\mathbf{v}_m^{\\star} E_{ij} \\mathb...") (3672 3793 "\\( \\mathbf{v}_m^{\\star} E_{ij} \\mathbf{v}_l = \\lef...") (3833 3879 "\\( \\left( \\lambda_l \\lambda_m \\right)^{1/4} \\)")) nil nil)
  (org-latex-preview--place-from-elements dvisvgm ((latex-fragment (:standard-properties [3461 nil nil nil 3573 0 nil nil nil nil nil nil nil nil #<buffer do.org> nil nil (paragraph (:standard-properties [3335 3335 3335 3797 3798 1 nil nil element t ... nil nil nil #<buffer do.org> nil nil ...]))] :value [org-element-deferred org-element--substring (0 112) nil])) (latex-fragment (:standard-properties [3672 nil nil nil 3793 0 nil nil nil nil nil nil nil nil #<buffer do.org> nil nil (paragraph (:standard-properties [3335 3335 3335 3797 3798 1 nil nil element t ... nil nil nil #<buffer do.org> nil nil ...]))] :value [org-element-deferred org-element--substring (0 121) nil])) (latex-fragment (:standard-properties [3833 nil nil nil 3880 1 nil nil nil nil nil nil nil nil #<buffer do.org> nil nil (paragraph (:standard-properties [3800 3800 3800 3940 3940 0 nil nil element t ... nil nil nil #<buffer do.org> nil nil ...]))] :value [org-element-deferred org-element--substring (0 46) nil]))))
  (org-latex-preview-fragments dvisvgm 3159 4151)
  (org-latex-preview--preview-region 3159 4151)
  (org-latex-preview nil)
  (funcall-interactively org-latex-preview nil)
  (command-execute org-latex-preview)
yantar92 commented 6 months ago

70 files scanned, 67 files contains IDs, and 1381 IDs found.

This message is about updating the ID cache. On the latest main, I have improved performance of ID cache scanning significantly. Try it.