* [PATCH] Raise gc-cons-threshold for org-element-cache-map
@ 2023-08-23 7:34 Allen Li
2023-08-23 9:57 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Allen Li @ 2023-08-23 7:34 UTC (permalink / raw)
To: Org Mode List
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Attached patch, I think it's self-explanatory so the commit message is
reproduced here:
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.
[-- Attachment #2: 0001-org-element-Raise-gc-cons-threshold-for-org-element-.patch --]
[-- Type: text/x-patch, Size: 1355 bytes --]
From 01e06d90f27b8204e69508351b7fca9c03e7af32 Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Wed, 23 Aug 2023 00:22:06 -0700
Subject: [PATCH] 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.
---
lisp/org-element.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index b2c5b0402..694a4f43f 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -7568,7 +7568,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)
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Raise gc-cons-threshold for org-element-cache-map
2023-08-23 7:34 [PATCH] Raise gc-cons-threshold for org-element-cache-map Allen Li
@ 2023-08-23 9:57 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-08-23 9:57 UTC (permalink / raw)
To: Allen Li; +Cc: Org Mode List
Allen Li <vianchielfaura@gmail.com> writes:
> Attached patch, I think it's self-explanatory so the commit message is
> reproduced here:
>
> org-element: Raise gc-cons-threshold for org-element-cache-map
Thanks!
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c905565fa
--
Ihor Radchenko // yantar92,
Org mode contributor,
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-23 9:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 7:34 [PATCH] Raise gc-cons-threshold for org-element-cache-map Allen Li
2023-08-23 9:57 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).