bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1024: Large C++ files load slowly, regardless of font-lock-maximum-s


From: Alan Mackenzie
Subject: bug#1024: Large C++ files load slowly, regardless of font-lock-maximum-size
Date: 25 Sep 2008 14:53:03 +0200
Date: Thu, 25 Sep 2008 12:53:03 +0000 (UTC)
User-agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386))

Hi, John.

John W <jw_spambox@yahoo.com> wrote:
> To reproduce:
> (1) Generate a 3M C++ file.
> (2) Load file.
> (3) Wait for emacs. <-- bug

> I'm using jit-lock, but I tested lazy-lock, and the behavior is the same.

> font-lock-maximum-size is the default.  I.e.
> Its value is 256000

> I used edebug to see what emacs was doing, and it gave me a stack like:

> c-literal-limits()
>  c-neutralize-syntax-in-CPP(1 3527391 3527390)
>  funcall(c-neutralize-syntax-in-CPP 1 3527391 3527390)
>  (if nil c-before-font-lock-function (funcall c-before-font-lock-function 
> (point-min) (point-max) (- ... ...)))
>  (save-excursion (if c-get-state-before-change-function (funcall 
> c-get-state-before-change-function ... ...)) (if nil 
> c-before-font-lock-function (funcall c-before-font-lock-function ... ... 
> ...)))
>  (save-restriction (widen) (save-excursion (if 
> c-get-state-before-change-function ...) (if nil c-before-font-lock-function 
> ...)))
>  c-common-init(c++-mode)
>  c++-mode()
>  set-auto-mode-0(c++-mode nil)
>  set-auto-mode()
>  normal-mode(t)
>  after-find-file(nil t)

Thanks for taking the trouble to generate this stack dump; it identifies
the problem completely.

This bug was caused by a previous bug fix which introduced a complete
scan over the entire buffer when it's loaded.  One function,
`c-neutralize-syntax-in-CPP' had been coded very inefficiently.  It was
recoded for speed on 2008-05-24, committed in
.../emacs/lisp/progmodes/cc-mode.el version 1.58.2.12 (Emacs 22 branch)
and version 1.75 (trunk) at savannah.


To get the fixed version, either:
(i) Upgrade to Emacs 22.3; or
(ii) If you're using the Emacs 23 CVS, update your version.

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).








reply via email to

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