Subject: bug#58558: 29.0.50; re-search-forward is slow in some buffers

From: Ihor Radchenko <[email-masked]>
Date: Wed, 14 Dec 2022 13:23:02 +0000

Eli Zaretskii <[email-masked]> writes:

> I think I'm confused now: what do you mean by "executing the
> benchmark"?  I thought the problem was that each "execution of the
> benchmark" was slower than the one before it, in which case markers
> added between benchmarks _are_ relevant.  But you say they aren't?
> What did I miss?

Increasing time of running benchmarks is just a symptom.
The real issue I am experiencing is that re-search-forward becomes
slower as I keep using Emacs. `garbage-collect' helps, but not in a long
term.

Basically, running

M-: (benchmark-progn (goto-char (point-min)) (while (re-search-forward yant/re nil t)))

- right after starting Emacs is taking 3-4 seconds.
- after several hours -- 10-20 seconds
- in Emacs 28, <1 sec.

Markers may or may not be a problem. If they are, it is not necessarily
related to markers created when I run the benchmarks. May also be some
markers created during the Emacs session.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>