From: Maxim Nikulin <email@example.com> To: firstname.lastname@example.org Subject: Re: [PATCH] Bug: fragile org refile cache Date: Thu, 29 Apr 2021 23:51:53 +0700 [thread overview] Message-ID: <email@example.com> (raw) In-Reply-To: <877dklxecq.fsf@localhost> On 29/04/2021 23:08, Ihor Radchenko wrote: > Maxim Nikulin 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? My benchmarks may be incorrect due to for development version I did not compile files. I did not purged outline path cache as well. https://firstname.lastname@example.org/ > 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) ^ t I suppose. I agree with such test. Notice however the following patch (warning: :level and :max-level a cached with the same key) https://email@example.com/ Avoiding call to org-get-outline-path and using custom structure during single pass scan through the buffer allowed to significantly improve performance. > 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) I may be wrong with the following statement. Attempt to profile org-refile-get-targets could give quite different results. I have seen a note that Emacs use internally a cache for only 5 compiled regular expressions. Just one extra regexp and every matching function require compiling of its regexp just wiped from the cache. It is a time consuming procedure. I am unsure whether you added all regexps used (directly or through function calls) by inner loop of org-refile-get-targets.
next prev parent reply other threads:[~2021-04-29 16:53 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-28 16:09 Maxim Nikulin 2021-04-29 0:50 ` Samuel Wales 2021-04-29 1:29 ` Ihor Radchenko 2021-04-29 1:34 ` Samuel Wales 2021-04-29 12:45 ` Maxim Nikulin 2021-04-29 14:12 ` Ihor Radchenko 2021-04-29 15:04 ` Maxim Nikulin 2021-04-29 16:08 ` Ihor Radchenko 2021-04-29 16:51 ` Maxim Nikulin [this message] 2021-04-30 16:56 ` Maxim Nikulin 2021-05-01 14:48 ` Maxim Nikulin 2021-05-02 6:59 ` Ihor Radchenko 2021-05-04 16:55 ` Maxim Nikulin 2021-05-05 0:53 ` Ihor Radchenko 2021-04-29 13:30 ` Ihor Radchenko 2021-04-29 19:17 ` Tim Cross 2021-04-29 22:43 ` Samuel Wales 2021-05-02 7:03 ` Ihor Radchenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org' \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH] Bug: fragile org refile cache' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).