<#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 <yantar92@gmail.com> writes:

Christopher Miles <numbchild@gmail.com> 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