unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastian Beischer <bastian.beischer@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: 30367@debbugs.gnu.org
Subject: bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file.
Date: Fri, 09 Feb 2018 10:16:53 +0100	[thread overview]
Message-ID: <87372a8quy.fsf@gmail.com> (raw)
In-Reply-To: <20180208184232.GB4335@ACM> (Alan Mackenzie's message of "Thu, 8 Feb 2018 18:42:32 +0000")

Hello Alan,

Alan Mackenzie <acm@muc.de> writes:

> On Thu, Feb 08, 2018 at 17:25:58 +0000, Alan Mackenzie wrote:
>> Hello, Bastian.
>
> [ .... ]
>
>> I think I understand what's happening, now.
>
>> c-looking-at-or-maybe-in-bracelist attempts to go back over the innards
>> of a brace list to the enclosing "{".  At L+122, in new handling for a
>> comma, I rather rashly inserted a `c-go-up-list-backward' to test whether
>> the comma is inside a brace.  This was in a loop, once for each sexp.
>
>> In your sample file there is, at L10,653 a construct at top level with
>> _lots_ of commas.  My loop is trying to go to the non-existent containing
>> brace for each of these commas, so ends up scanning to BOB for each of
>> them.  This entire activity will be being done several times.
>
>> I timed a single `c-go-up-list-backward' from one of these commas at
>> 0.033 seconds.  30 of these take about a second, and my machine is
>> anything but slow.
>
>> So, I just need to work out a way of fixing this, which may take some
>> while (sorry).
>
> Actually, that cond arm with the `c-go-up-list-backward' was merely an
> "optimisation".  :-(  If I simply remove it, the code goes ~30 times
> faster, without triggering any successes in the test suite.
>
> Would you please try out the following patch on real code, and either
> confirm to me that it fixes the bug, or tell me what it breaks.  Thanks!
>
>
>
> diff -r e8b2c6141f97 cc-engine.el
> --- a/cc-engine.el	Fri Feb 02 20:34:15 2018 +0000
> +++ b/cc-engine.el	Thu Feb 08 18:39:40 2018 +0000
> @@ -10547,13 +10547,6 @@
>  		      (looking-at c-return-key))
>  		 (setq braceassignp t)
>  		 nil)
> -		((and c-has-compound-literals
> -		      (eq (char-after) ?,))
> -		 (save-excursion
> -		   (when (and (c-go-up-list-backward nil lim)
> -			      (eq (char-after) ?\())
> -		     (setq braceassignp t)
> -		     nil)))
>  		((eq (char-after) ?=)
>  		 ;; We've seen a =, but must check earlier tokens so
>  		 ;; that it isn't something that should be ignored.
>
>
>
> [ .... ]
>

Yes, this patch fixes the slowdown. But since I don't understand what
the original commit which introduced the slowdown tried to fix I cannot
comment on whether or not its the right thing to do within the context
of that commit.

I will run emacs with the patch included for a while and will let you
know in case I find any problems!

Thanks for tackling this so quickly!

>> > Cheers
>> > Bastian





  parent reply	other threads:[~2018-02-09  9:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 10:34 bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file Bastian Beischer
2018-02-06 10:40 ` Bastian Beischer
     [not found] ` <mailman.8662.1517913372.27995.bug-gnu-emacs@gnu.org>
2018-02-07 15:24   ` Alan Mackenzie
     [not found]   ` <20180207152435.72040.qmail@mail.muc.de>
2018-02-07 15:27     ` Bastian Beischer
2018-02-07 21:21       ` Alan Mackenzie
     [not found]       ` <20180207212145.GA3963@ACM>
2018-02-07 21:53         ` Bastian Beischer
2018-02-07 22:26           ` Alan Mackenzie
2018-02-07 22:45             ` Bastian Beischer
2018-02-08 17:25               ` Alan Mackenzie
     [not found]               ` <20180208172558.GA4335@ACM>
2018-02-08 18:42                 ` Alan Mackenzie
     [not found]                 ` <20180208184232.GB4335@ACM>
2018-02-09  9:16                   ` Bastian Beischer [this message]
2018-03-20 18:49                     ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87372a8quy.fsf@gmail.com \
    --to=bastian.beischer@gmail.com \
    --cc=30367@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).