[Top][All Lists]

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

Re: c-mode eats resources?

From: Juri Linkov
Subject: Re: c-mode eats resources?
Date: Sun, 19 Feb 2006 19:18:57 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>    Apparently, C mode constantly uses processor time even nothing is
>    done in the buffer.  E.g. if I open a C file in Emacs and go to a
>    different desktop and start `top' there, it shows Emacs in the
>    first few lines with 3--7% usage of CPU.  This cannot be right.
>    Can anybody reproduce this?

This problem can be reproduced with the following code evaluated
on a buffer in C mode:

(let ((start (float-time)))
  (font-lock-mode 1)
  (jit-lock-fontify-now (point-min) (point-max))
  (- (float-time) start))

> Did you customize font-lock related stuff to use potentially
> inefficient regexps?

I don't know whether due to very inefficient regexps or not, but in
the last few months fontification in C mode deteriorated drastically.
Evaluating the code above on alloc.c using `emacs -q --no-site-file'
on 1GHZ in different Emacs versions produces the following results:

GNU Emacs 21.4 - 0.5 sec
CVS 2004-04    - 3.5 sec
CVS 2005-09    - 6.8 sec
CVS 2006-02    - 10.0 sec

Given a few percents of CPU utilization, no wonder that stealth
fontification lasts several minutes.

Juri Linkov

reply via email to

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