[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org e9bd219e35 2/4: org-element--cache-verify-element:
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org e9bd219e35 2/4: org-element--cache-verify-element: Improve performance |
Date: |
Wed, 21 Sep 2022 00:59:29 -0400 (EDT) |
branch: externals/org
commit e9bd219e35090a80833834bbee97124ad9320f64
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element--cache-verify-element: Improve performance
* lisp/org-element.el: Remove unconditional checks when verification
is disabled. Do not call costly `derived-mode-p' and unnecessary
`org-element-property'.
---
lisp/org-element.el | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 72a20b6ce4..53d1275617 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -7094,11 +7094,6 @@ change, as an integer."
"Verify correctness of ELEMENT when `org-element--cache-self-verify' is
non-nil.
Return non-nil when verification failed."
- ;; Verify correct parent for the element.
- (unless (or (org-element-property :parent element)
- (eq 'org-data (org-element-type element)))
- (org-element--cache-warn "Got element without parent (cache active?: %S).
Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S"
(org-element--cache-active-p) element)
- (org-element-cache-reset))
(let ((org-element--cache-self-verify
(or org-element--cache-self-verify
(and (boundp 'org-batch-test) org-batch-test)))
@@ -7106,10 +7101,14 @@ Return non-nil when verification failed."
(if (and (boundp 'org-batch-test) org-batch-test)
1
org-element--cache-self-verify-frequency)))
+ ;; Verify correct parent for the element.
+ (unless (or (not org-element--cache-self-verify)
+ (org-element-property :parent element)
+ (eq 'org-data (org-element-type element)))
+ (org-element--cache-warn "Got element without parent (cache active?:
%S). Please report it to Org mode mailing list (M-x
org-submit-bug-report).\n%S" (org-element--cache-active-p) element)
+ (org-element-cache-reset))
(when (and org-element--cache-self-verify
(org-element--cache-active-p)
- (derived-mode-p 'org-mode)
- (org-element-property :parent element)
(eq 'headline (org-element-type element))
;; Avoid too much slowdown
(< (random 1000) (* 1000
org-element--cache-self-verify-frequency)))