Seems known, assuming this is the same thing. I have not experienced the phenomenon or used proof blocks, so I'm just going by google-fu matching (which finds a lot):

https://emacs.stackexchange.com/questions/46561/org-mode-9-too-slow-with-long-code-blocks
https://emacs.stackexchange.com/questions/62376/slow-markdown-mode-as-emacs-spends-lots-of-time-fontifying
https://emacs.stackexchange.com/questions/46110/help-needed-to-debug-very-slow-markdown-mode
https://www.reddit.com/r/emacs/comments/c28svb/has_emacs_always_been_this_slow_at_highlighting/
https://lists.gnu.org/archive/html/emacs-orgmode/2015-07/msg00215.html

As with all things like this, I'd work through the old information first to understand the true problem, if any improvements/workarounds exist, etc. Then this lands in some bucket of outcomes:
- it's a novel find and therefore a bug (due diligence searching says this is not the case)
- it's known bad, but not addressed (due to time or inability), but it can be worked around (nuggets exist in the links above as well as other results if you search "emacs fontify proof block slow")
- a true "fix" is possible, in which case this would require pinpointing the exact problem and asking for alternatives or proposing a better/faster way to fontify


Hope that helps,
John

P.S. This looks independent to Org, so I'm not sure if this is the best place for the eventual resolution as this may have nothing to do with Org? I'm no emacs guru, but from my skim I'm guessing org just pulls in some other package vs. having it's own fontification engine.

On Mon, Jun 21, 2021 at 1:31 PM Léo Ackermann <leo.komba@gmail.com> wrote:
Dear all,

I am working in an org-file of reasonable size (<2000 lines): my first paper written in org-mode. Everything fine (and fast) until I started to add `#+BEGIN_proof / #+END_proof` within my .org to make my .pdf export prettier. This caused the editing of the proofs to be very slow: navigation within the proof is fast but adding/removing any char takes around 4s per char.
It seems that the fontify function is responsible for that (see screenshot). As far as I understand, this function tries to fontify the whole block as soon as a single char is modified. In my case, it then tries to fontify a whole proof (~4 pages in my .pdf, with many LaTeX formulas) several times per second...

Is there a way to make this fontify function to act "around my cursor" ? 

Best,
Leo

--
Here the profiler's report when adding a single char
image.png
 Spec.
- Emacs 27.2 (doom emacs 2.0.9) (I just updated them)