[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 7e9d927298 1/4: org-element--cache-active-p: Improv
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 7e9d927298 1/4: org-element--cache-active-p: Improve performance |
Date: |
Wed, 21 Sep 2022 00:59:29 -0400 (EDT) |
branch: externals/org
commit 7e9d9272980383a9bfdba936af2af9b86055994c
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element--cache-active-p: Improve performance
* lisp/org-element.el (org-element--cache-active-p): Remove expensive
`derived-mode-p' call. Reshuffle the conditions to avoid costly
`memq' call as much as possible. Inline the function.
---
lisp/org-element.el | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 721bc68107..72a20b6ce4 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5679,12 +5679,12 @@ This function assumes `org-element--headline-cache' is
a valid AVL tree."
;;;; Tools
-(defun org-element--cache-active-p (&optional called-from-cache-change-func-p)
+(defsubst org-element--cache-active-p (&optional
called-from-cache-change-func-p)
"Non-nil when cache is active in current buffer."
(and org-element-use-cache
org-element--cache
- (derived-mode-p 'org-mode)
(or called-from-cache-change-func-p
+ (eq org-element--cache-change-tic (buffer-chars-modified-tick))
(and
;; org-num-mode calls some Org structure analysis functions
;; that can trigger cache update in the middle of changes. See
@@ -5699,8 +5699,7 @@ This function assumes `org-element--headline-cache' is a
valid AVL tree."
;; `combine-change-calls' because the buffer is potentially
;; changed without notice (the change will be registered
;; after exiting the `combine-change-calls' body though).
- (memq #'org-element--cache-after-change after-change-functions))
- (eq org-element--cache-change-tic (buffer-chars-modified-tick)))))
+ (memq #'org-element--cache-after-change after-change-functions)))))
;; FIXME: Remove after we establish that hashing is effective.
(defun org-element-cache-hash-show-statistics ()