[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 49df468 1/3: org-element-cache-map: Report pre-proc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 49df468 1/3: org-element-cache-map: Report pre-process time in statistics |
Date: |
Fri, 26 Nov 2021 23:57:25 -0500 (EST) |
branch: externals/org
commit 49df468849aa3e39496d9aa308617938a9a02d77
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element-cache-map: Report pre-process time in statistics
* lisp/org-element.el (org-element-cache-map): Calculate time elapsed
while filling the cache gaps during pre-processing.
---
lisp/org-element.el | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index b5a4bf2..752912e 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -7292,6 +7292,7 @@ the cache."
;; Statistics
(time (float-time))
(predicate-time 0)
+ (pre-process-time 0)
(count-predicate-calls-match 0)
(count-predicate-calls-fail 0))
;; Skip to first element within region.
@@ -7308,9 +7309,13 @@ the cache."
(and (eq granularity 'element)
(or next-re fail-re)))
(let ((org-element-cache-map--recurse t))
- (org-element-cache-map
- #'ignore
- :granularity granularity)
+ (let ((before-time (float-time)))
+ (org-element-cache-map
+ #'ignore
+ :granularity granularity)
+ (cl-incf pre-process-time
+ (- (float-time)
+ before-time)))
;; Re-assign the cache root after filling the cache
;; gaps.
(setq node (cache-root)))
@@ -7474,13 +7479,14 @@ the cache."
(when (and org-element--cache-map-statistics
(or (not org-element--cache-map-statistics-threshold)
(> (- (float-time) time)
org-element--cache-map-statistics-threshold)))
- (message "Mapped over elements in %S. %d/%d predicate matches.
Total time: %f sec. Time running predicates: %f sec (%f sec avg)
+ (message "Mapped over elements in %S. %d/%d predicate matches.
Total time: %f sec. Pre-process time: %f sec. Time running predicates: %f sec
(%f sec avg)
Calling parameters: :granularity %S :restrict-elements %S :next-re %S
:fail-re %S :from-pos %S :to-pos %S :limit-count %S :after-element %S"
(current-buffer)
count-predicate-calls-match
(+ count-predicate-calls-match
count-predicate-calls-fail)
(- (float-time) time)
+ pre-process-time
predicate-time
(if (zerop (+ count-predicate-calls-match
count-predicate-calls-fail))