Subject: bug#71644: 30.0.50; Severe slowdown in larger files with markers beginning in emacs 29+

From: Ihor Radchenko <[email-masked]>
Date: Wed, 26 Jun 2024 13:49:09 +0000

Stefan Monnier <[email-masked]> writes:

> Yes, definitely.  The threshold is at about N/100 where N is the number
> of markers/headings.  But why 100?

Maybe because

bytepos - best_below_byte > 5000
and distance += BYTECHAR_DISTANCE_INCREMENT;
(BYTECHAR_DISTANCE_INCREMENT = 50)

Then, (/ 5000 50) ; -> 100.

In other words,
for (tail = BUF_MARKERS (b); tail; tail = tail->next)
loop is roughly bound to (min number-of-markers 100)-ish
repetitions. So, once the number of markers exceeds 100, there is no
more scaling with the marker number.

-- 
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>