emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Bug: fragile org refile cache


From: Ihor Radchenko
Subject: Re: [PATCH] Bug: fragile org refile cache
Date: Fri, 30 Apr 2021 00:08:53 +0800

Maxim Nikulin <manikulin@gmail.com> writes:

> Curiously my experience is that avoiding this lazy cache with 
> backtracking and maintaining custom structure during sequential scan of 
> the buffer works several times faster.

My experience is exactly opposite. Or maybe I miss something. Can you
elaborate?

> ... However it is appropriate time to 
> populate the cache you mentioned. Unfortunately it is still necessary to 
> cleanup heading text, and it consumes significant time.

Did you do any benchmarks? I just tried

Outline path without cache:

(benchmark-run 1
  (goto-char (point-min))
  (while (re-search-forward "^\\*+" nil t)
    (org-get-outline-path t nil))) => (6.051079914 1 0.2864724879999869)

Outline path with cache:

(benchmark-run 1
  (goto-char (point-min))
  (while (re-search-forward "^\\*+" nil t)
    (org-get-outline-path t nil))) => (1.658461165 0 0.0)

Just cleanup heading text:

(benchmark-run 1
  (goto-char (point-min))
  (while (re-search-forward "^\\*+" nil t)
    (let ((case-fold-search nil))
      (looking-at org-complex-heading-regexp)
      (if (not (match-end 4)) ""
        ;; Remove statistics cookies.
        (org-trim
         (org-link-display-format
          (replace-regexp-in-string
           "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
           (match-string-no-properties 4)))))))) => (0.013364877 0 0.0)

Best,
Ihor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]