[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C mode too slow
From: |
Alan Mackenzie |
Subject: |
Re: C mode too slow |
Date: |
Mon, 13 Jun 2011 14:59:22 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi, Stefan,
On Sun, Jun 12, 2011 at 08:38:11PM +0000, Alan Mackenzie wrote:
> >> _and_ because editing lisp.h is virtually impossible these days. I
> >> have to use an old Emacs - almost each editing step takes about 15
> >> secs here with the more recent Emacs versions :-(
> > I tend to find editing code such as lisp.h too slow as well. Can we
> > do something about it?
> lisp.h is slow in "brace desserts", since CC Mode uses braces as anchor
> points, particularly whilst font locking. This should have been fixed
> by the optimisation of c-parse-state.
> However, comparing the trunk with Emacs 23.3 the number of calls to
> c-parse-state has increased by a factor of ~9, cancelling out the
> optimisation. :-( I'm looking to see why this has happened.
> I'm actually looking at a large file (without a single brace) called
> AT91SAM9263_INC.h, the one which triggered this optimisation. What
> seems to me slow in lisp.h is scrolling over areas which haven't yet
> been fontified since loading. Once that is done, I think things move at
> a decent speed. Is there anything particular, other than initial
> scrolling, which is very slow in lisp.h?
Could you try editing lisp.h after applying this patch, please, and let
me know how it goes:
*** cc-fonts.el.~7~ 2011-02-04 22:10:01.000000000 +0000
--- cc-fonts.el 2011-06-13 14:49:30.000000000 +0000
***************
*** 1192,1198 ****
;; Are we at a declarator? Try to go back to the declaration
;; to check this. Note that `c-beginning-of-decl-1' is slow,
;; so we cache its result between calls.
! (let (paren-state bod-res encl-pos is-typedef)
(goto-char start-pos)
(save-excursion
(unless (and decl-search-lim
--- 1192,1200 ----
;; Are we at a declarator? Try to go back to the declaration
;; to check this. Note that `c-beginning-of-decl-1' is slow,
;; so we cache its result between calls.
! (let (paren-state bod-res encl-pos is-typedef
! c-recognize-knr-p) ; Strictly speaking bogus,
! ; but it speeds lisp.h up tremendously.
(goto-char start-pos)
(save-excursion
(unless (and decl-search-lim
--
Alan Mackenzie (Nuremberg, Germany).