all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Kentaro NAKAZAWA <kentaro.nakazawa@nifty.com>
Cc: Kan-Ru Chen <kanru@kanru.info>, emacs-devel@gnu.org
Subject: Re: Slow fontification in C mode buffers
Date: Fri, 6 Jan 2012 22:08:06 +0000	[thread overview]
Message-ID: <20120106220806.GA3217@acm.acm> (raw)
In-Reply-To: <87ehvwxd8g.fsf@nifty.com>

Hello, Kentaro.

On Fri, Dec 23, 2011 at 10:56:15AM +0900, Kentaro NAKAZAWA wrote:
> Hello. (sorry for my poor english ;)

> Other pattern attached.
> The file is very heavy at edit and undo.


> Geoff Gole <geoffgole@gmail.com> writes:

> > If another data point will help, I've also noticed *very* slow c-mode
> > fontification in a script generated header,
> > /usr/include/GL/gl_mangle.h. In case you don't have this header, a
> > copy is attached.

> > The file is basically several thousand #defines.


> // -*- mode: c++ -*-

> namespace NameSpace1 {
>   namespace NameSpace2 {

>     enum {
>       kFooBarBazType_Attribute0000	= 0x0000,	// Comment0000
>       kFooBarBazType_Attribute0001	= 0x0001,	// Comment0001
>       kFooBarBazType_Attribute0002	= 0x0002,	// Comment0002
>       kFooBarBazType_Attribute0003	= 0x0003,	// Comment0003
>
> [....]
>
>       kFooBarBazType_Attribute0220	= 0x00dc,	// Comment0220
>       kFooBarBazType_Attribute0221	= 0x00dd,	// Comment0221
>       kFooBarBazType_Attribute0222	= 0x00de,	// Comment0222
>     };

>   } // namespace Namespace2
> } // namespace Namespace1

Would you try this patch and let me know how it goes, please.


*** orig/cc-fonts.el	2012-01-06 12:27:14.000000000 +0000
--- cc-fonts.el	2012-01-06 21:48:54.000000000 +0000
***************
*** 1394,1399 ****
--- 1394,1414 ----
  	      (c-fontify-recorded-types-and-refs)
  	      nil)
  
+ 	     ((and (not c-enums-contain-decls)
+ 		   ;; An optimisation quickly to eliminate scans of long enum
+ 		   ;; declarations in the next cond arm.
+ 		   (let ((paren-state (c-parse-state)))
+ 		     (and
+ 		      (numberp (car paren-state))
+ 		      (save-excursion
+ 			(goto-char (car paren-state))
+ 			(c-backward-token-2)
+ 			(or (looking-at c-brace-list-key))
+ 			(progn
+ 			  (c-backward-token-2)
+ 			  (looking-at c-brace-list-key))))))
+ 	      t)
+ 
  	     (t
  	      ;; Are we at a declarator?  Try to go back to the declaration
  	      ;; to check this.  If we get there, check whether a "typedef"
*** orig/cc-langs.el	2012-01-06 12:27:14.000000000 +0000
--- cc-langs.el	2012-01-06 12:54:00.000000000 +0000
***************
*** 2930,2935 ****
--- 2930,2941 ----
  		    ; generics is not yet coded in CC Mode.
  (c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists))
  
+ (c-lang-defconst c-enums-contain-decls
+   "Non-nil means that an enum structure can contain declarations."
+   t nil
+   java t)
+ (c-lang-defvar c-enums-contain-decls (c-lang-const c-enums-contain-decls))
+ 
  (c-lang-defconst c-recognize-paren-inits
    "Non-nil means that parenthesis style initializers exist,
  i.e. constructs like



> -- 
> Kentaro Nakazawa

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2012-01-06 22:08 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-03 13:19 Slow fontification in C mode buffers Eli Zaretskii
2011-12-03 15:03 ` Sujith
2011-12-03 15:14   ` Eli Zaretskii
2011-12-03 15:32     ` Sujith
2011-12-03 15:18 ` Alan Mackenzie
2011-12-03 16:19   ` Eli Zaretskii
2011-12-13 15:31   ` Kan-Ru Chen
2011-12-14 11:19     ` Alan Mackenzie
2011-12-14 11:30     ` Alan Mackenzie
2011-12-14 12:23       ` Alan Mackenzie
2011-12-14 13:14     ` Alan Mackenzie
2011-12-14 15:02       ` Kan-Ru Chen
2011-12-15 13:43     ` Alan Mackenzie
2011-12-15 16:16       ` Kan-Ru Chen
2011-12-15 18:12         ` Alan Mackenzie
2011-12-16  2:32           ` Kan-Ru Chen
2011-12-16 11:26             ` Alan Mackenzie
2011-12-17 16:06               ` Kan-Ru Chen
2011-12-21 10:56                 ` Alan Mackenzie
2011-12-21 13:33                   ` Geoff Gole
2011-12-21 16:04                     ` Alan Mackenzie
2011-12-21 16:48                       ` Geoff Gole
2011-12-21 18:06                         ` Alan Mackenzie
2011-12-21 18:16                     ` Eli Zaretskii
2011-12-21 18:32                       ` Geoff Gole
2011-12-21 19:35                         ` Eli Zaretskii
2011-12-23  1:56                     ` Kentaro NAKAZAWA
2011-12-23 12:03                       ` Alan Mackenzie
2012-01-06 22:08                       ` Alan Mackenzie [this message]
2012-01-07  0:09                         ` Kentaro NAKAZAWA
2012-01-07 13:50                           ` Alan Mackenzie
2012-01-08  1:26                             ` Kentaro NAKAZAWA
2012-01-08 10:05                               ` Alan Mackenzie
2012-01-20 17:26                               ` Alan Mackenzie
2012-02-06 16:14                                 ` Kentaro NAKAZAWA
2011-12-22 16:06                   ` Kan-Ru Chen
2012-01-13 19:12                 ` Alan Mackenzie
2012-01-14  9:12                   ` Kan-Ru Chen
2012-01-15 21:12                 ` Alan Mackenzie
2012-01-22  4:20                   ` Kan-Ru Chen
2011-12-03 21:15 ` Alan Mackenzie
2011-12-04  6:00   ` Eli Zaretskii

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=20120106220806.GA3217@acm.acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=kanru@kanru.info \
    --cc=kentaro.nakazawa@nifty.com \
    /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.