emacs-devel
[Top][All Lists]
Advanced

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

C Mode: acceleration in brace deserts.


From: Alan Mackenzie
Subject: C Mode: acceleration in brace deserts.
Date: Thu, 3 Dec 2009 16:21:29 +0000
User-agent: Mutt/1.5.9i

Hi, Richard, Yidong and Emacs!

I have just committed my enhancements to CC Mode's `c-parse-state'.
This is a central and critical part of Emacs which maintains a cache of
the positions of certain braces, and fewer parens of other types.  As
the position of interest in a buffer moves, this cache is updated to
reflect the new position.

In the previous version, the cache handling was severely suboptimal in
"brace deserts", large areas of buffers entirely lacking in braces.  In
the extreme, the algorithm was scanning from BOB every time
c-parse-state was called.

An example of such an extreme can be downloaded from
<http://www.muc.de/~acm/AT91SAM9263_inc.h>.  To see the effect, visit
it, do M-> and try scrolling back a page at a time.  Please compare the
previous version with the new.

The difference is noticeable even in our own .../src/lisp.h.  It is now
noticeably less sluggish when scrolling backwards from EOB.

I have tested these changes thoroughly, principly by calculating
c-parse-state successively at an infinite number (1000) of random points
in the buffers lisp.h and xdisp.c, then comparing "old" results with
"new" results.  Many thanks to Stefan for `diff-refine-hunk' :-).

If anybody notices anything odd, please let me know.

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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