From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kan-Ru Chen Newsgroups: gmane.emacs.devel Subject: Re: Slow fontification in C mode buffers Date: Fri, 16 Dec 2011 10:32:20 +0800 Message-ID: <87ty51i6vf.fsf@isil.kanru.info> References: <83vcpxbxn0.fsf@gnu.org> <20111203151824.GA4566@acm.acm> <87pqfso5d3.fsf@isil.kanru.info> <20111215134332.GA5698@acm.acm> <87y5udizdy.fsf@isil.kanru.info> <20111215181215.GA3464@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1324002758 4057 80.91.229.12 (16 Dec 2011 02:32:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2011 02:32:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 03:32:34 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RbNb7-00052b-PL for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2011 03:32:34 +0100 Original-Received: from localhost ([::1]:44622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNb6-0006WI-0q for ged-emacs-devel@m.gmane.org; Thu, 15 Dec 2011 21:32:32 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:56487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNb3-0006W7-G0 for emacs-devel@gnu.org; Thu, 15 Dec 2011 21:32:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbNb1-0002nw-IT for emacs-devel@gnu.org; Thu, 15 Dec 2011 21:32:29 -0500 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:53356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNb1-0002nW-FC for emacs-devel@gnu.org; Thu, 15 Dec 2011 21:32:27 -0500 Original-Received: by qcsd17 with SMTP id d17so1782553qcs.0 for ; Thu, 15 Dec 2011 18:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=MBe/zz9eYJI7EAKLST6wxuI3uzi6XKBNwc5BKosBMos=; b=NTripgF6WdAS0HQnkb/SyPNJMENwjqUmxNJugzIpK9jmpOt+5lWvdZeIyqKMaSyAFA laH4YvAaE1vVYCAI/ZHP8fZTDxZbCBiiOIqIdW9fRT9+pFl6ev/ywEgmvsoJef/6T8Ji 3xJ4zf5et/eayLe7giYeMjhrKZmxB/bfhUnCs= Original-Received: by 10.229.137.3 with SMTP id u3mr725510qct.91.1324002746671; Thu, 15 Dec 2011 18:32:26 -0800 (PST) Original-Received: from isil.kanru.info (218-160-154-35.dynamic.hinet.net. [218.160.154.35]) by mx.google.com with ESMTPS id gg6sm16598690qab.3.2011.12.15.18.32.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Dec 2011 18:32:25 -0800 (PST) Original-Received: from localhost ([127.0.0.1] helo=isil.kanru.info) by isil.kanru.info with esmtp (Exim 4.77) (envelope-from ) id 1RbNau-0006g7-7L; Fri, 16 Dec 2011 10:32:20 +0800 In-Reply-To: <20111215181215.GA3464@acm.acm> (Alan Mackenzie's message of "Thu, 15 Dec 2011 18:12:15 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146735 Archived-At: Alan Mackenzie writes: > Hello, again. > > On Fri, Dec 16, 2011 at 12:16:25AM +0800, Kan-Ru Chen wrote: >> Alan Mackenzie writes: > >> > Would you please try the following patch and let me know how it goes. >> > Thanks! > >> No change. c-cheap-inside-bracelist-p seems not called at all. > > Hmm. The place c-cheap-inside-bracelist-p is inside > c-font-lock-declarations, it can scarcely avoid being called. > > Forgive me for asking you this, but are you sure you byte compiled the > two files after patching them, etc.? I forgot that I've set font-lock-maximum-decoration to 2. I tested with emacs -Q again. The first font-lock is slow, but pretty fast after that. It occasionally hangs when I C-v the buffer. Below is the elp-results: Function Name Call Count Elapsed Time Average Time c-beginning-of-decl-1 1203 269.68204399 0.2241746001 c-beginning-of-statement-1 1242 269.60064599 0.2170697632 c-crosses-statement-barrier-p 241143 258.95701700 0.0010738732 c-font-lock-declarations 179 160.73329700 0.8979513798 c-find-decl-spots 179 160.732037 0.8979443407 c-at-macro-vsemi-p 336240 159.34210499 0.0004738939 c-in-literal 336240 150.66956800 0.0004481012 c-slow-in-literal 336240 149.19536500 0.0004437168 c-literal-limits 374344 85.649792999 0.0002287996 c-beginning-of-syntax 522725 73.183792999 0.0001400043 c-font-lock-enclosing-decls 179 57.476122000 0.3210956536 c-backward-sws 1215297 12.826941000 1.055...e-05 c-beginning-of-macro 746198 4.2144529999 5.647...e-06 c-parse-state 3326 1.0435710000 0.0003137615 c-parse-state-1 3326 0.9558269999 0.0002873803 c-forward-decl-or-cast-1 2089 0.4252059999 0.0002035452 c-append-to-state-cache 3178 0.3954000000 0.0001244178 c-font-lock-declarators 135 0.3788929999 0.0028066148 c-syntactic-re-search-forward 432 0.3418039999 0.0007912129 c-forward-type 5008 0.2934280000 5.859...e-05 c-remove-stale-state-cache 2819 0.2530829999 8.977...e-05 c-font-lock-<>-arglists 179 0.1875940000 0.0010480111 c-font-lock-enum-tail 179 0.1730750000 0.0009668994 c-parse-state-get-strategy 3326 0.149166 4.484...e-05 c-get-fallback-scan-pos 330 0.1159620000 0.0003514000 c-forward-name 3509 0.1159080000 3.303...e-05 c-remove-stale-state-cache-backwards 507 0.1071120000 0.0002112662 c-font-lock-complex-decl-prepare 179 0.0924410000 0.0005164301 c-backward-token-2 6514 0.0913669999 1.402...e-05 c-cheap-inside-bracelist-p 1954 0.0872260000 4.463...e-05 c-state-literal-at 520 0.0582760000 0.0001120692 c-forward-label 707 0.0382930000 5.416...e-05 c-at-toplevel-p 128 0.0342679999 0.0002677187 c-syntactic-content 2688 0.0300650000 1.118...e-05 c-forward-sws 8547 0.0256289999 2.998...e-06 c-state-balance-parens-backwards 506 0.0250620000 4.952...e-05 c-search-uplist-for-classkey 128 0.0244740000 0.0001912031 c-looking-at-decl-block 128 0.0230999999 0.0001804687 c-syntactic-skip-backward 128 0.0213989999 0.0001671796 c-after-conditional 204 0.0180919999 8.868...e-05 c-beginning-of-current-token 4902 0.0143600000 2.929...e-06 c-get-cache-scan-pos 3474 0.0119859999 3.450...e-06 c-end-of-macro 2192 0.0077970000 3.557...e-06 c-syntactic-end-of-macro 245 0.0049240000 2.009...e-05 c-add-type 258 0.0042930000 1.663...e-05 c-looking-at-inexpr-block 95 0.0039379999 4.145...e-05 c-forward-annotation 2089 0.0028189999 1.349...e-06 c-skip-comments-and-strings 1694 0.0025100000 1.481...e-06 c-font-lock-invalid-string 392 0.0018759999 4.785...e-06 c-state-get-min-scan-pos 3674 0.0011130000 3.029...e-07 c-most-enclosing-brace 1142 0.0008480000 7.425...e-07 c-fontify-recorded-types-and-refs 475 0.0005930000 1.248...e-06 c-forward-keyword-clause 33 0.000508 1.539...e-05 c-append-lower-brace-pair-to-state-cache 1 0.00038 0.00038 c-safe-position 256 0.0003150000 1.230...e-06 c-forward-to-cpp-define-body 32 0.0002930000 9.156...e-06 c-end-of-current-token 32 6.500...e-05 2.031...e-06 c-leave-cc-mode-mode 6 1.300...e-05 2.166...e-06 c-forward-single-comment 2 1e-05 5e-06 -- Kanru