"Rohit Patnaik" <[email protected]> writes:

>> make repro actually skews the profiler results, because it enables
>> additional debugging.
>
> I re-ran the repro steps with =make repro REPRO_DEBUG=no=, with the latest 
> code
> from the org-mode repo (commit: a7174bc304134ef5d10b8ff8b7a72c5d8aa4dc80) and 
> I
> got the attached results. It seems like the majority of the time is being 
> spent
> in =org-fold-core-get-folding-spec=. Drilling a little deeper, I see that a 
> lot
> of the time is still being spent in =org-element-parse-to=, and it seems to be
> calling =org-element--cache-put= a lot.

I can confirm.
You are running into an edge case with the parser when we need to add a
huge number of new elements into AVL-tree, triggering NlogN complexity.
Because Emacs's implementation of AVL-tree does not have a good
locality, this is fairly slow.
Not easy to fix.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to