org-element: Raise gc-cons-threshold for org-element-cache-map

This garbage collects many times when calling
`org-get-buffer-tags' (such as during tag completion) in a large file
with many tags.  Raise `gc-cons-threshold' as this may affect other
callers in large files.

Note that `org-element-parse-buffer' also raises `gc-cons-threshold'
as a precedent.

This has no effect on most callers and increases performance for
extreme cases.

* lisp/org-element.el (org-element-cache-map): Raise
`gc-cons-threshold'.
This commit is contained in:
Allen Li 2023-08-23 00:22:06 -07:00 committed by Ihor Radchenko
parent 579e8c5723
commit c905565fa8
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -7577,7 +7577,8 @@ the cache."
(let ((mk (make-marker)))
(set-marker mk to-pos)
(setq to-pos mk)))
(let (;; Bind variables used inside loop to avoid memory
(let ((gc-cons-threshold #x40000000)
;; Bind variables used inside loop to avoid memory
;; re-allocation on every iteration.
;; See https://emacsconf.org/2021/talks/faster/
tmpnext-start tmpparent tmpelement)