From: Allen Li <vianchielfaura@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: [PATCH] Raise gc-cons-threshold for org-element-cache-map
Date: Wed, 23 Aug 2023 00:34:31 -0700 [thread overview]
Message-ID: <CAJr1M6e2o1yhc6SC3DLwkBftodNe+1x_7ixRF5yJGs1+9RieRQ@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2023-08-23 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 7:34 Allen Li [this message]
2023-08-23 9:57 ` [PATCH] Raise gc-cons-threshold for org-element-cache-map Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJr1M6e2o1yhc6SC3DLwkBftodNe+1x_7ixRF5yJGs1+9RieRQ@mail.gmail.com \
--to=vianchielfaura@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).