[Top][All Lists]

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

Slow fontification in C mode buffers

From: Sujith
Subject: Slow fontification in C mode buffers
Date: Sat, 3 Dec 2011 20:33:15 +0530

Eli Zaretskii wrote:
> Did anyone else notice that scrolling the first time through a very
> large comment in C mode became extremely slow lately?  For example,
> visit xdisp.c in "emacs -Q", type M-<, then hit C-v several times in
> quick succession.  Then watch in disbelief how long it takes for Emacs
> to scroll by these several screenfuls.  In my case (6.5 year old
> hardware), I even see the "hourglass cursor" kick in, and the CPU
> meter shows 100% utilization of one execution unit for about 5
> seconds.
> If you then type M-< and again hit C-v several times, scrolling will
> be at its usual speed.  Scrolling outside of large comments is also
> reasonably fast, even for the first time.
> Therefore, my prime suspect is font-lock, which is triggered by the
> need to display a portion of the buffer that was not fontified yet.
> This suspicion is corroborated by the fact that jit-stealth font-lock
> of xdisp.c causes extremely high peaks of CPU usage, and Emacs
> response time becomes very sluggish.
> Is there something in C Mode's arrangements for fontification,
> specifically related to comments, that was changed lately and that can
> explain this slowdown?

I can see this behavior on a low-spec machine - Intel Atom @ 1.66 GHz with
1GB RAM running GNU/Linux. C mode is really slow with maximum font-lock
decoration and hitting C-v a few times is enough for the screen to lock up,
while the CPU chugs away at full usage. After the buffer has been fully 
scrolling is fast. My current workaround is to set font-lock-maximum-decoration
to 2.

I tried the pretests to see if things have changed, but 24.0.92 has pretty much
the same behavior.


reply via email to

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