emacs-devel
[Top][All Lists]
Advanced

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

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


From: Eli Zaretskii
Subject: Re: New optimisations for long raw strings in C++ Mode.
Date: Thu, 11 Aug 2022 09:21:18 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Alan Mackenzie <acm@muc.de>,  gregory@heytings.org,  larsi@gnus.org,
>   emacs-devel@gnu.org
> Date: Wed, 10 Aug 2022 18:31:00 -0400
> 
> > 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
> comment/strings/code.
> Our guesses can be wrong, tho.  And making such a guess without some
> AI-style thingy is somewhat difficult.

All true, but the alternative of going to BOB/BOL and coming back is
much worse when BOB/BOL is very far away.

> `syntax-begin-function` could use such a thing, but we made it obsolete
> because making it work well tends to be costly.

More costly than going back 20 million characters and then coming
back?

IOW, what is and isn't costly could change when compared with
alternatives.  For example, I recently made one of low-level
subroutines in the display engine do something "costly" when the
buffer has very long lines, and the result turned out to be a very
large win in those cases.  The "heavy" calculation is only used when
the buffer is flagged to have very long lines; we could do something
similar for syntax analysis as well.



reply via email to

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