all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Richard M Stallman <rms@gnu.org>
Cc: bug-cc-mode@gnu.org, Dave Milter <davemilter@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: open large file with C code: is it realy should be so slow?
Date: Tue, 6 Jan 2009 19:03:57 +0000	[thread overview]
Message-ID: <20090106190357.GC5612@muc.de> (raw)
In-Reply-To: <E1LJzNu-0007Y4-Sa@fencepost.gnu.org>

Hi, Richard!

On Mon, Jan 05, 2009 at 07:01:26PM -0500, Richard M Stallman wrote:
> I too find C mode painfully slow these days.  I wonder what changed to
> make it so much slower than it was.  Perhaps the only relevant change
> is that Font Lock is now enabled; I never used to enable it.  Even so,
> it must make a lot of users unhappy.

First of all, sorry.

Font lock consumes masses of cycles, yes.  Set
`font-lock-maximum-decoration' to 2; that might make it fast enough.

But no, not too many users seem too unhappy about it - at least, not
those who complain on bug-cc-mode@gnu.org or emacs-devel.  Or, more
accurately, most complaints received have been because of specific
pessimisations which only manifest themselves in peculiar files (as in
the current thread) or in very big files.  These are relatively easy to
fix.

What speed of processor have you got?  With my 1.2 GHz Athlon, there is
a brief pause (~ 1 second) every now and then, while caches get checked
(not cheques getting cashed), and suchlike.  When I type, sometimes the
display is quite a few characters behind the keyboard.  But pauses like
that don't bother me too much; I just carry on typing, subconsciously
confident that Emacs will cache up soon enough.  But that's just me.

>From the tone of your post, I'm guessing that you're generally irritated
by sluggishness in C Mode rather because of any specific long wait.
There is at least one "peculiar" file in emacs, .../src/lisp.h in which C
Mode is sluggish locating BODs because of the number of #defines in it -
that shows up if you do C-x 4 a at its EOF.  But is there anything in
particular you've noticed which is particularly painful?

I'd guess that C Mode slowed down quite a lot in CC Mode 5.30, when the
font locking was taken into CC Mode, with the default decoration level
(3), prioritising accuracy over speed.  Since then, I've added a bit of
scanning to set syntax-table text properties so that the following sort
of stuff doesn't foul up parse-partial-sexp:

    #define LBRACE {
    #error unbalanced single quotes can't be ruled out.

K&R style declarations (more precisely, having to check for them) causes
quite a slow down.  They're never(?) used in modern C code, so maybe we
could flush them from .../src/*.[ch] and make K&R parsing an option.

-- 
Alan Mackenzie (Nuremberg, Germany).

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB


  parent reply	other threads:[~2009-01-06 19:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 10:01 open large file with C code: is it realy should be so slow? Dave Milter
2008-12-01 12:37 ` Alan Mackenzie
2009-01-04 22:07   ` Dave Milter
2009-01-04 23:31     ` Alan Mackenzie
2009-11-01 17:01       ` Dave Milter
2009-01-06  0:01     ` Richard M Stallman
2009-01-06  5:52       ` Chong Yidong
2009-01-06 22:59         ` Richard M Stallman
2009-01-07  1:16           ` Chong Yidong
2009-01-08 11:37             ` Richard M Stallman
2009-01-08 12:42               ` Alan Mackenzie
2009-01-06 19:03       ` Alan Mackenzie [this message]
2009-01-06 21:50         ` Stefan Monnier
2009-12-04 15:25     ` Alan Mackenzie
2009-12-19 10:51       ` Dave Milter
2009-12-27 10:33         ` Dave Milter

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=20090106190357.GC5612@muc.de \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=davemilter@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /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.