org-element-parse-buffer: Avoid excessive garbage collection

* lisp/org-element.el (org-element-parse-buffer): Increase
`gc-cons-threshold' to improve performance.  In my tests on large Org
buffers, garbage collection took 50% of the time without increasing
the threshold.
This commit is contained in:
Ihor Radchenko 2021-11-25 18:21:03 +08:00
parent 08e595f312
commit 20ed794b92
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -4478,7 +4478,8 @@ or objects within the parse tree.
This function assumes that current major mode is `org-mode'."
(save-excursion
(goto-char (point-min))
(let ((org-data (org-element-org-data-parser)))
(let ((org-data (org-element-org-data-parser))
(gc-cons-threshold #x40000000))
(org-skip-whitespace)
(org-element--parse-elements
(point-at-bol) (point-max)