Subject: bug#11545: 24.0.96-mac-2.92; Strange speed problem scrolling in C++ code

From: Alan Mackenzie <[email-masked]>
Date: Sat, 2 Nov 2019 10:59:25 +0000

Hello, Stefan.

On Fri, Nov 01, 2019 at 19:40:31 +0100, Stefan Kangas wrote:
> Hi Alan,

> Alan Mackenzie <[email-masked]> writes:

> > On Mon, May 28, 2012 at 06:05:15PM -0500, John Wiegley wrote:
> >> >>>>> John Wiegley <[email-masked]> writes:

> >> >>>>>> YAMAMOTO Mitsuharu <[email-masked]> writes:
> >> >> With the Time Profiler in Instrument.app, I found that fontification
> >> >> of CC Mode in Emacs 24 is much heavier and causes frequent GCs than
> >> >> that in Emacs 23.  Please try the following:

> >> >>   1. Start Emacs 24 Mac port with -Q (alternatively, pressing the
> >> >>      shift key.)
> >> >>   2. M-x load-file PREFIX/share/emacs/23.4/lisp/progmodes/cc-fonts.elc
> >> >>      RTE.
> >> >>   3. Replay scrolling a large C++ file.

> >> >> I'm not sure if this slowdown is intended or expected.

> >> > Indeed, this makes the speed situation much better on Emacs 24.0.97.

> >> I can now confirm that loading CC-Mode 5.32.3 into Emacs 23.4 causes
> >> the identical speed issues that I was seeing with Emacs 24.0.97, so
> >> this is a performance issue in the latest CC-Mode, not a bug in Emacs
> >> 24 or with Mac-Port Emacs.

> >> To the CC-Mode maintainers: is there a way to disable the slower, "more
> >> correct" mode in the latest CC-Mode, and go back to the entirely
> >> sufficient (for me) mode of previous versions?

> > Not as such, no.  The only workaround at the moment is to use a
> > "pre-correct" version of CC Mode in place of an up to date one.

> > I've just done a binary chop on CC Mode versions, and it seems the latest
> > version before (?the first of) these enhancements was the one created by
> > this (mercurial) changeset (the repository can be downloaded from
> > <http://cc-mode.sourceforge.net>):

> >     changeset:   5109:981fa4f0270c
> >     parent:      5107:bd4013c5633b
> >     user:        acmacm
> >     date:        Wed Sep 15 17:47:52 2010 +0000
> >     files:       cc-engine.el
> >     description:
> >     (c-forward-<>-arglist-recur): Fix an infinite recursion.

> > To undo these changes would be difficult, since several later
> > enhancements and bug fixes are based on the new code.  I'll see if I can
> > find some way of optimising the offending code - most of the time it's
> > doing expensive checks and finding nothing.

> > Anyhow, I've got the problem flagged as a bug now.  Thanks again for
> > reporting it.

> Just to follow up on this bug, which has seen no update in the last 7
> years.  Has it been fixed by now?

"Fixed" doesn't seem the right term, really.  There have been several
improvemnts in the scrolling speed over the years (the latest less than
an hour ago ;-).  When I scroll through a typical ~700k C++ buffer, I now
experience mild sluggishness, a C-v taking a small fraction of a second,
but longer than instantaneous.  This is perhaps less than ideal on a
slowish machine (which mine is not), but there's a tradeoff between rapid
fontification and correct fontification.

I think this bug should now be closed.

> Best regards,
> Stefan Kangas

-- 
Alan Mackenzie (Nuremberg, Germany).