From: Alan Mackenzie <acm@muc.de>
To: Kan-Ru Chen <kanru@kanru.info>
Cc: emacs-devel@gnu.org
Subject: Re: Slow fontification in C mode buffers
Date: Wed, 21 Dec 2011 10:56:26 +0000 [thread overview]
Message-ID: <20111221105626.GA3263@acm.acm> (raw)
In-Reply-To: <87pqfngp3r.fsf@isil.kanru.info>
Hello, Kanru.
On Sun, Dec 18, 2011 at 12:06:00AM +0800, Kan-Ru Chen wrote:
> Please forgive me for using the other files, it is closer to the real
> case. You can get the file from
> https://hg.mozilla.org/mozilla-central/raw-file/tip/dom/base/nsDOMClassInfo.cpp
OK, now I understand. I feel your pain. ;-(
> (i) Loaded elp and instrumented the c- package.
> (ii) Loaded nsDOMClassInfo.cpp
> (iii) Done M-x c++-mode
> (iv) Done M-x elp-results (to clear the accumulated times)
> (v) C-s battery until failing to find
> (vi) M-x elp-results.
> Before:
> c-beginning-of-decl-1 201 13.065947999 0.0650047164
> c-beginning-of-statement-1 229 13.061191 0.0570357685
> c-crosses-statement-barrier-p 35466 11.622212999 0.0003277001
> c-font-lock-declarations 16 9.4090929999 0.5880683124
> c-find-decl-spots 16 9.4089879999 0.5880617499
> c-at-macro-vsemi-p 46569 6.6139159999 0.0001420240
> c-in-literal 46569 5.4569670000 0.0001171802
> c-literal-limits 51666 3.1393819999 6.076...e-05
> c-backward-sws 176682 1.6644079999 9.420...e-06
> c-beginning-of-macro 104078 0.5568430000 5.350...e-06
> c-state-safe-place 72459 0.3154430000 4.353...e-06
> c-parse-state 225 0.1421229999 0.0006316577
> c-parse-state-1 225 0.1385559999 0.0006158044
> c-font-lock-enclosing-decls 16 0.1365140000 0.0085321250
> c-append-to-state-cache 196 0.0641449999 0.0003272704
> After:
> c-beginning-of-decl-1 137 9.6732900000 0.0706079562
> c-beginning-of-statement-1 165 9.6693369999 0.0586020424
> c-crosses-statement-barrier-p 25584 8.5505400000 0.0003342143
> c-font-lock-declarations 16 6.059768 0.3787355
> c-find-decl-spots 16 6.059666 0.378729125
> c-at-macro-vsemi-p 35149 4.7420429999 0.0001349126
> c-in-literal 35149 4.0154739999 0.0001142414
> c-literal-limits 38962 2.5425719999 6.525...e-05
> c-backward-sws 128214 1.1421259999 8.907...e-06
> c-beginning-of-macro 78145 0.3845660000 4.921...e-06
> c-state-safe-place 54703 0.2419970000 4.423...e-06
> c-parse-state 317 0.1464209999 0.0004618958
> c-font-lock-enclosing-decls 16 0.137945 0.0086215625
> c-parse-state-1 317 0.1331939999 0.0004201703
> c-font-lock-declarators 24 0.065522 0.0027300833
It looks like my latest change is saving ~25% of the runtime. That is
not enough, not nearly enough. Also, your hardware is _much_ faster than
mine. ;-)
The problem is quite clear - because of the dearth of
semicolons/right-braces, searching backwards to the beginning of
statements (function "c-beginning-of-statement-1") takes forever during
fontification. To solve this will involve putting a limit on backward
search and somehow coping with not finding BO-statement.
This is going to be a lot of work, and I'm not going to be able to get it
finished this year. Sorry. But I'm sure the bug can be fixed.
In the meantime, I suggest turning font-lock off for this file.
> -- Kanru
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2011-12-21 10:56 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-03 13:19 Slow fontification in C mode buffers Eli Zaretskii
2011-12-03 15:03 ` Sujith
2011-12-03 15:14 ` Eli Zaretskii
2011-12-03 15:32 ` Sujith
2011-12-03 15:18 ` Alan Mackenzie
2011-12-03 16:19 ` Eli Zaretskii
2011-12-13 15:31 ` Kan-Ru Chen
2011-12-14 11:19 ` Alan Mackenzie
2011-12-14 11:30 ` Alan Mackenzie
2011-12-14 12:23 ` Alan Mackenzie
2011-12-14 13:14 ` Alan Mackenzie
2011-12-14 15:02 ` Kan-Ru Chen
2011-12-15 13:43 ` Alan Mackenzie
2011-12-15 16:16 ` Kan-Ru Chen
2011-12-15 18:12 ` Alan Mackenzie
2011-12-16 2:32 ` Kan-Ru Chen
2011-12-16 11:26 ` Alan Mackenzie
2011-12-17 16:06 ` Kan-Ru Chen
2011-12-21 10:56 ` Alan Mackenzie [this message]
2011-12-21 13:33 ` Geoff Gole
2011-12-21 16:04 ` Alan Mackenzie
2011-12-21 16:48 ` Geoff Gole
2011-12-21 18:06 ` Alan Mackenzie
2011-12-21 18:16 ` Eli Zaretskii
2011-12-21 18:32 ` Geoff Gole
2011-12-21 19:35 ` Eli Zaretskii
2011-12-23 1:56 ` Kentaro NAKAZAWA
2011-12-23 12:03 ` Alan Mackenzie
2012-01-06 22:08 ` Alan Mackenzie
2012-01-07 0:09 ` Kentaro NAKAZAWA
2012-01-07 13:50 ` Alan Mackenzie
2012-01-08 1:26 ` Kentaro NAKAZAWA
2012-01-08 10:05 ` Alan Mackenzie
2012-01-20 17:26 ` Alan Mackenzie
2012-02-06 16:14 ` Kentaro NAKAZAWA
2011-12-22 16:06 ` Kan-Ru Chen
2012-01-13 19:12 ` Alan Mackenzie
2012-01-14 9:12 ` Kan-Ru Chen
2012-01-15 21:12 ` Alan Mackenzie
2012-01-22 4:20 ` Kan-Ru Chen
2011-12-03 21:15 ` Alan Mackenzie
2011-12-04 6:00 ` Eli Zaretskii
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=20111221105626.GA3263@acm.acm \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=kanru@kanru.info \
/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.