[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New optimisations for long raw strings in C++ Mode.

From: Stefan Monnier
Subject: Re: New optimisations for long raw strings in C++ Mode.
Date: Wed, 10 Aug 2022 18:31:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> Really?  Then please tell me how is it that we the humans can detect
> incorrect fontifications even when shown partial strings and comments?

That's usually because we can tell the difference between valid C code
and human text and then based on that we can heuristically guess whats
Our guesses can be wrong, tho.  And making such a guess without some
AI-style thingy is somewhat difficult.

`syntax-begin-function` could use such a thing, but we made it obsolete
because making it work well tends to be costly.  But that was used for
"really nearby" (i.e. find a safe spot near enough that we can avoid
scanning 10kB of code, meaning that the heuristic shouldn't take more
time than scanning 10kB of code).  Maybe to speed up `syntax-ppss` in
large buffers, we could re-introduce something like
`syntax-begin-function` but where the idea is to try and find a safe
spot heuristically within the preceding 1MB or so to avoid scanning the
preceding GBs of code: this would give us a higher time-budget for the
heuristic, making it possible to work well enough (and it would be used
only in buffers >1MB).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]