Hi, A while ago Ihor asked me to find a reliable way to reproducible the known performance issues with the regexp scanning in org-do-latex-and-related.
Today I discovered that the performance degradation can be reproduced easily in the etc/ORG-NEWS file. I'm using the version of the ORG-NEWS file from the olp branch of https://github.com/karthink/org-mode but the problem may be visible in the ORG-NEWS file on main as well. To reproduce it, 1. Open ORG-NEWS, all level-1 headings should be folded. 2. Press <tab> on the first title, "Version 9.8 (not released yet)" 3. Place the cursor on any of the level-2 headings, such as "New features" or "New and changed options" and press <tab> again. 4. Opening this level-2 heading takes 4-5 seconds on my machine. Related configuration in my init file: (setq org-highlight-latex-and-related '(latex)) (plist-put org-format-latex-options :matchers '("begin" "\\(" "\\[")) The profile is attached. This is entirely because of the re-search-forward in org-do-latex-and-related. Hope this helps with a fix. Karthik
org-do-latex-and-related-profile.eld
Description: Binary data
