Re: Is it possible to optimize Org Mode org-activate-links ?
Christopher Miles writes: > Should I use the following options? I saw the warning. Does this freeze > happens often? I decide to try it. Setting org-element-use-cache to t should be enough to see differences. Best, Ihor
Re: Is it possible to optimize Org Mode org-activate-links ?
<#secure method=pgpmime mode=sign> Thanks for your hints. Should I use the following options? I saw the warning. Does this freeze happens often? I decide to try it. (defvar org-element-use-cache nil "Non-nil when Org parser should cache its results. WARNING: for the time being, using cache sometimes triggers freezes. Therefore, it is disabled by default. Activate it if you want to help debugging the issue.") (defvar org-element-cache-sync-idle-time 0.6 "Length, in seconds, of idle time before syncing cache.") (defvar org-element-cache-sync-duration 0.04 "Maximum duration, as a time value, for a cache synchronization. If the synchronization is not over after this delay, the process pauses and resumes after `org-element-cache-sync-break' seconds.") (defvar org-element-cache-sync-break 0.3 "Duration, as a time value, of the pause between synchronizations. See `org-element-cache-sync-duration' for more information.") Ihor Radchenko writes: Christopher Miles writes: 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? You can try to use org-element-cache. That might help. Best, Ihor -- [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
Re: Is it possible to optimize Org Mode org-activate-links ?
Christopher Miles writes: > 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? You can try to use org-element-cache. That might help. Best, Ihor
Is it possible to optimize Org Mode org-activate-links ?
<#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% - # 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%