From: Alan Mackenzie <acm@muc.de>
To: Tadeus Prastowo <tadeus.prastowo@unitn.it>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Processing speed in large C++ raw strings.
Date: Sat, 27 Apr 2019 11:37:34 +0000 [thread overview]
Message-ID: <20190427113734.GA4822@ACM> (raw)
In-Reply-To: <CAN-HRFaPsVzNocOdBcUr4xb5ahuAnboaJonczMh3nQcL_DZzdQ@mail.gmail.com>
Hello, Tadeus.
On Fri, Apr 26, 2019 at 22:15:28 +0200, Tadeus Prastowo wrote:
> Hi Alan,
> On Thu, Apr 25, 2019 at 8:41 PM Alan Mackenzie <acm@muc.de> wrote:
> > I have now optimized CC Mode, such that each such self-insert-command
> > now takes around 0.07s-0.1s. I used two strategies for this: (i) breaking out
> > of (expensive) fontification routines early, when the region being
> > fontified is nothing but a string; (ii) Not fontifying the entire raw
> > string for a change to only a small part of it.
> I have been working with C++ template metaprograms for two years, and
> since quite early, I have experienced CC Mode being very sluggish that
> I often switch back-and-forth between cc-mode and text-mode.
> I have not made any report since I don't feel like sparing my time to
> collect some data for the report now that switching to text-mode does
> the trick. So, since you are already at it, perhaps you may want to
> find out why even scrolling the buffer in cc-mode is very slow when
> visiting the file at
> http://git.savannah.nongnu.org/cgit/tice.git/plain/tests/v1/test-v1_internals_program.cpp?
You've submitted a bug report now. :-)
> Specifically, I built master at commit
> 82fc8ca6ba179596928db614ab903e44968ef44e and fired the result with
> `emacs -Q' to visit the file locally. Then, to experience the
> sluggishness, I pressed M-> followed by M-v several times. To further
> experience it, I started to edit some template parameters, such as
> changing `node1' to node `node5' in line 680.
Thanks for drawing my attention to this problem with lots of templates.
The bug is that, in a certain low-level place, CC Mode was failing to
mark the < and > "as parentheses" (with syntax-table text properties),
hence a lot of unneeded buffer scanning was being done.
The following patch should speed up the scrolling operation markedly.
It does not become instantaneous, but takes a fraction of a second,
compared with the several seconds it has taken up to now. Would you
please try it out.
diff -r 1940f96b9799 cc-engine.el
--- a/cc-engine.el Fri Apr 26 01:01:07 2019 +0000
+++ b/cc-engine.el Sat Apr 27 11:30:06 2019 +0000
@@ -5539,7 +5539,9 @@
(prog1 (looking-at "\\s(")
(forward-char))))
(backward-char)
- (if (c-forward-<>-arglist nil) ; Should always work.
+ (if (let ((c-parse-and-markup-<>-arglists t)
+ (c-restricted-<>-arglists t))
+ (c-forward-<>-arglist nil)) ; Should always work.
(when (> (point) to)
(setq bound-<> (point)))
(forward-char)))
> Thank you very much for your work.
> --
> Best regards,
> Tadeus
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2019-04-27 11:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 18:36 Processing speed in large C++ raw strings Alan Mackenzie
2019-04-26 1:25 ` Dmitry Gutov
2019-04-26 20:15 ` Tadeus Prastowo
2019-04-27 2:15 ` Stefan Monnier
2019-04-27 10:37 ` Tadeus Prastowo
2019-04-27 11:37 ` Alan Mackenzie [this message]
2019-04-27 15:35 ` Tadeus Prastowo
2019-04-27 17:29 ` Alan Mackenzie
2019-04-30 14:44 ` Tadeus Prastowo
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190427113734.GA4822@ACM \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=tadeus.prastowo@unitn.it \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.