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: Alan Mackenzie
Subject: Re: New optimisations for long raw strings in C++ Mode.
Date: Sun, 7 Aug 2022 14:40:47 +0000

Hello, Lars.

On Sun, Aug 07, 2022 at 15:34:45 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > Hmm.  Something is different on my setup from yours.  After my
> > optimisations, I do:

> Is this on the current trunk?

Yes, after the committing of

commit a332034160bf8e1f38039cd2d37898de6f94508f
Author: Alan Mackenzie <acm@muc.de>
Date:   Sun Aug 7 12:26:16 2022 +0000

    CC Mode: Fix looping in patch from yesterday


> > (i) Emacs -Q
> > (ii) M-: (setq long-line-threshold nil)
> > (ii) C-x C-f ~/long-line.cc RET; This is a file containing a 1MB raw
> >   string.
> > (iii) This loads and displays in somewhere between 1 and 2 seconds.
> > (iv) C-x 5 b long-line2.cc RET  M-x c++-mode RET
> > (v) Type in char long_line [] = R"foo(
> > (vi) Type in RET, twice
> > (vii) Type in )foo";

> Yup.

> > (ix) C-x 5 o
> > (x) Get the long line into the kill ring, with movement commands and
> >   M-w.
> > (xi) C-x 5 o.
> > (xii) Put point on the blank line 2.
> > (xiii) C-y.
> > (xiv) This takes less than a second to display.

> It's still hanging for me after 20s.

> > What does your 1MB string look like?  Does it contain lots of "s?  CC
> > Mode needs to search through the yanked line for the first occurrence of
> > )foo", which is why it is not instantaneous.  It also has to put a
> > syntax-table text property on each " which isn't the terminating )foo",
> > which is another reason it's not instantaneous.

> The string I'm yanking is just 1MB worth of x and y characters (and no
> spaces or anything).

Mine looked like "012345678 012345678 012345678 .... 012345678 ".  I
tried replacing each space by a 9, but the string still yanks with the
expected minimal sluggishness.

Actually, I just tried it again after M-: (setq long-line-threshold
10000).  It hangs.  Did you omit step (ii) above, by any chance?

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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