Browse Source

org-element-cache-map: Do not refresh cache before processing

* lisp/org-element.el (org-element-cache-map--recurse): Remove.
(org-element-cache-map): Do not perform a cache-filling pass.  This is
not gaining any speed in practice.
Ihor Radchenko 2 years ago
parent
commit
3c11e9df6e
1 changed files with 0 additions and 23 deletions
  1. 0 23
      lisp/org-element.el

+ 0 - 23
lisp/org-element.el

@@ -7273,7 +7273,6 @@ buffers."
 
 
 (defvar warning-minimum-log-level) ; Defined in warning.el
 (defvar warning-minimum-log-level) ; Defined in warning.el
 
 
-(defvar org-element-cache-map--recurse nil)
 (defvar org-element-cache-map-continue-from nil
 (defvar org-element-cache-map-continue-from nil
   "Position from where mapping should continue.
   "Position from where mapping should continue.
 This variable can be set by called function, especially when the
 This variable can be set by called function, especially when the
@@ -7554,28 +7553,6 @@ the cache."
             (goto-char (or start (point-min)))
             (goto-char (or start (point-min)))
             (move-start-to-next-match next-element-re)
             (move-start-to-next-match next-element-re)
             (unless (and start (>= start to-pos))
             (unless (and start (>= start to-pos))
-              ;; Pre-process cache filling all the gaps.
-              (unless (or org-element-cache-map--recurse
-                          (cache-gapless-p)
-                          ;; Pre-processing all the elements in large
-                          ;; buffers when NEXT-RE/FAIL-RE are provided
-                          ;; may be much slower compared to using
-                          ;; regexp.
-                          (and (eq granularity 'element)
-                               (or next-re fail-re)))
-                (let ((org-element-cache-map--recurse t))
-                  (setq 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)))
-                (setf (alist-get granularity org-element--cache-gapless)
-                      org-element--cache-change-tic))
               (while node
               (while node
                 (setq data (avl-tree--node-data node))
                 (setq data (avl-tree--node-data node))
                 (if (and leftp (avl-tree--node-left node) ; Left branch.
                 (if (and leftp (avl-tree--node-left node) ; Left branch.