Subject: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt

From: Theodor Thornhill <[email-masked]>
Date: Sun, 27 Sep 2020 11:54:23 +0200

Eli Zaretskii <[email-masked]> writes:

[...]

>
> Thanks.  This seems to indicate that this loop in
> c-pps-to-string-delim is the culprit:
>
>     (while (progn
> 	     (parse-partial-sexp (point) end nil nil st-s 'syntax-table)
> 	     (unless (bobp)
> 	       (c-clear-syn-tab (1- (point))))
> 	     (setq st-pos (point))
> 	     (and (< (point) end)
> 		  (not (eq (char-before) ?\")))))
>
> But I'm confused why the "fast" profile starts with
> font-lock-fontify-region, whereas the "slow" profile doesn't have
> font-lock-fontify-region anywhere...
>

Thanks for digging into this. I can add one more thing that I see. When
this variable is set to some char, typing that character and then quote
mark would only insert one quote and fontify to end of buffer as a
string.

Example:

 - type @"             // (#") for pike-mode
 - see whole buffer get fontified
 - no extra quote mark is inserted to make a proper pair.

What I would expect:

 - type @"
 - see @""
 - type normally inside quote marks.

I am not sure how this is related, if at all, but found it noticeable
enough to add to this discussion.

Also, if the 'multiline-string' variable is not set, typing @" would
behave as expected, with the pair being closed and nothing other than
string is fontified.

> Hopefully, Alan can take it from here.

Theo