[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scrolling huge buffers and cc-mode
From: |
Eli Zaretskii |
Subject: |
Re: Scrolling huge buffers and cc-mode |
Date: |
Tue, 18 Dec 2012 19:30:57 +0200 |
> Date: Tue, 18 Dec 2012 13:56:13 +0400
> From: Dmitry Antipov <address@hidden>
>
> Attached is a C++ source file to reproduce the painfully slow scrolling
> under cc-mode. Test is simple: just visit it and press <page-down>, or <next>,
> or whatever else bind to scroll-up-command, until buffer end is reached.
> The file is ~900K; when scrolling reaches 50%, everything is stopped, may
> be up to a few minutes (!), there is no response to any keyboard input
> including C-g, and CPU consumption is ~80-90%. After that, scrolling is
> resumed, but it's still _very_ slow. This looks like a C++ issue only
> since xdisp.c of nearly the same size may be scrolled much faster.
(Added Alan to the discussion.)
It looks like this is due to font-lock (invoked by JIT Lock each time
a new screenful is about to be displayed) that is specific to C++. To
see this, fontify the whole buffer, or turn on JIT Stealth and wait
for it to finish, and then try scrolling -- you will see a normal
scrolling speed.
While JIT Stealth was working, I noticed that one of my cores was busy
100%. So I turned on the profiler, and the result of running it for
about 1 minute is below. If I understand correctly, it blames
scan-sexps for most of the CPU load.
- apply 25518 84%
- jit-lock-stealth-fontify 25517 84%
- jit-lock-fontify-now 25517 84%
- byte-code 25517 84%
- run-hook-with-args 25517 84%
- font-lock-fontify-region 25517 84%
- c-font-lock-fontify-region 25517 84%
- font-lock-default-fontify-region 25495 84%
- font-lock-fontify-keywords-regio 25495 84%
- c-font-lock-enclosing-decls 25389 83%
- c-beginning-of-decl-1 25388 83%
- byte-code 25388 83%
- c-beginning-of-statement 25388 83%
- byte-code 25387 83%
- byte-code 25373 83%
scan-sexps 25372 83%
scan-lists 1 0%
- c-backward-sws 5 0%
looking-at 4 0%
previous-single-pr 1 0%
- c-looking-at-inexpr- 5 0%
looking-at 3 0%
c-backward-sws 2 0%
- c-beginning-of-macro 2 0%
beginning-of-line 2 0%
- c-crosses-statement- 2 0%
append 2 0%
- c-at-macro-vsemi-p 1 0%
- c-backward-sws 1 0%
looking-at 1 0%
+ c-parse-state 1 0%
+ c-font-lock-declarations 97 0%
+ #<compiled 0xea75d7> 5 0%
+ cwarn-font-lock-match-referenc 2 0%
+ c-font-lock-<>-arglists 2 0%
+ mapc 22 0%
+ auto-revert-buffers 1 0%
+ timer-event-handler 2496 8%
+ byte-code 1211 3%
+ redisplay_internal (C function) 392 1%
Automatic GC 294 0%
+ call-interactively 226 0%
+ jit-lock-stealth-fontify 95 0%
+ jit-lock-fontify-now 40 0%
+ run-hook-with-args 8 0%
+ font-lock-fontify-region 3 0%
+ profiler-calltree-walk 1 0%
tooltip-hide 1 0%
+ list 1 0%
+ input-pending-p 1 0%
- Scrolling huge buffers and cc-mode, Dmitry Antipov, 2012/12/18
- Re: Scrolling huge buffers and cc-mode,
Eli Zaretskii <=
- Re: Scrolling huge buffers and cc-mode, Stefan Monnier, 2012/12/18
- Re: Scrolling huge buffers and cc-mode, Alan Mackenzie, 2012/12/20
- Re: Scrolling huge buffers and cc-mode, Dmitry Antipov, 2012/12/21
- Re: Scrolling huge buffers and cc-mode, Alan Mackenzie, 2012/12/21
- Re: Scrolling huge buffers and cc-mode, Chong Yidong, 2012/12/21
Re: Scrolling huge buffers and cc-mode, Stefan Monnier, 2012/12/18