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: Sun, 18 Dec 2011 00:06:00 +0800 Message-ID: <87pqfngp3r.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> <87ty51i6vf.fsf@isil.kanru.info> <20111216112617.GA3445@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1324137978 10288 80.91.229.12 (17 Dec 2011 16:06:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 17 Dec 2011 16:06:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 17 17:06:14 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 1Rbwm5-0004Pb-8w for ged-emacs-devel@m.gmane.org; Sat, 17 Dec 2011 17:06:13 +0100 Original-Received: from localhost ([::1]:48970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbwm4-0005dC-NU for ged-emacs-devel@m.gmane.org; Sat, 17 Dec 2011 11:06:12 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbwm1-0005Wy-4l for emacs-devel@gnu.org; Sat, 17 Dec 2011 11:06:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rbwlz-0002bY-OC for emacs-devel@gnu.org; Sat, 17 Dec 2011 11:06:09 -0500 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:55806) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbwlz-0002bL-Lk for emacs-devel@gnu.org; Sat, 17 Dec 2011 11:06:07 -0500 Original-Received: by yenq10 with SMTP id q10so3442197yen.0 for ; Sat, 17 Dec 2011 08:06:06 -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=1rjW2zWZSYsTC7OGsVI1WeXneoGg3SwK0VC1XGz56cA=; b=t86eAWveGN/mJ2wrlfY8JY7Kl17XfshPypZzG+M/2FLYo/k7ZkBxYhSEjzB6PJ8UZ9 601slS+M2cS+HATPVjs5q76h/uIwTHRNTgXfnVFJQOYd6g07qs2GXJC932RUz7/BfqKg mJwkPcE3ftckWhBOQ+yktyv4fRpSnDPWSTTLI= Original-Received: by 10.236.139.199 with SMTP id c47mr17917558yhj.113.1324137966698; Sat, 17 Dec 2011 08:06:06 -0800 (PST) Original-Received: from isil.kanru.info (61-228-152-232.dynamic.hinet.net. [61.228.152.232]) by mx.google.com with ESMTPS id w68sm19982689yhe.14.2011.12.17.08.06.03 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 17 Dec 2011 08:06:05 -0800 (PST) Original-Received: from localhost.localdomain ([127.0.0.1] helo=isil.kanru.info) by isil.kanru.info with esmtp (Exim 4.77) (envelope-from ) id 1Rbwls-0001g4-MR; Sun, 18 Dec 2011 00:06:00 +0800 In-Reply-To: <20111216112617.GA3445@acm.acm> (Alan Mackenzie's message of "Fri, 16 Dec 2011 11:26:17 +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.213.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:146773 Archived-At: Alan Mackenzie writes: >> 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: > > You haven't said exactly how many operations, or what, you performed > before doing elp-results. In my elp results below, I've: > (i) Loaded elp and instrumented the c- package. > (ii) Loaded your file. > (iii) Done M-x c++-mode > (iv) Done M-x elp-results (to clear the accumulated times) > (v) M-> > (vi) M-x elp-results. Please forgive me for using the other files, it is closer to the real case. You can get the file from https://hg.mozilla.org/mozilla-central/raw-file/tip/dom/base/nsDOMClassInfo.cpp (i) Loaded elp and instrumented the c- package. (ii) Loaded nsDOMClassInfo.cpp (iii) Done M-x c++-mode (iv) Done M-x elp-results (to clear the accumulated times) (v) C-s battery until failing to find (vi) M-x elp-results. Before: c-beginning-of-decl-1 201 13.065947999 0.0650047164 c-beginning-of-statement-1 229 13.061191 0.0570357685 c-crosses-statement-barrier-p 35466 11.622212999 0.0003277001 c-font-lock-declarations 16 9.4090929999 0.5880683124 c-find-decl-spots 16 9.4089879999 0.5880617499 c-at-macro-vsemi-p 46569 6.6139159999 0.0001420240 c-in-literal 46569 5.4569670000 0.0001171802 c-literal-limits 51666 3.1393819999 6.076...e-05 c-backward-sws 176682 1.6644079999 9.420...e-06 c-beginning-of-macro 104078 0.5568430000 5.350...e-06 c-state-safe-place 72459 0.3154430000 4.353...e-06 c-parse-state 225 0.1421229999 0.0006316577 c-parse-state-1 225 0.1385559999 0.0006158044 c-font-lock-enclosing-decls 16 0.1365140000 0.0085321250 c-append-to-state-cache 196 0.0641449999 0.0003272704 After: c-beginning-of-decl-1 137 9.6732900000 0.0706079562 c-beginning-of-statement-1 165 9.6693369999 0.0586020424 c-crosses-statement-barrier-p 25584 8.5505400000 0.0003342143 c-font-lock-declarations 16 6.059768 0.3787355 c-find-decl-spots 16 6.059666 0.378729125 c-at-macro-vsemi-p 35149 4.7420429999 0.0001349126 c-in-literal 35149 4.0154739999 0.0001142414 c-literal-limits 38962 2.5425719999 6.525...e-05 c-backward-sws 128214 1.1421259999 8.907...e-06 c-beginning-of-macro 78145 0.3845660000 4.921...e-06 c-state-safe-place 54703 0.2419970000 4.423...e-06 c-parse-state 317 0.1464209999 0.0004618958 c-font-lock-enclosing-decls 16 0.137945 0.0086215625 c-parse-state-1 317 0.1331939999 0.0004201703 c-font-lock-declarators 24 0.065522 0.0027300833 -- Kanru