From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Unbearably slow editing in .h files Date: Sat, 23 Feb 2008 19:37:17 -0500 Message-ID: References: <200801222310.m0MN9cZq011601@sallyv1.ics.uci.edu> <8763xl492o.fsf@jurta.org> <200801230225.m0N2Ptmx012952@sallyv1.ics.uci.edu> <200801271954.m0RJsmBm003714@sallyv1.ics.uci.edu> <479DAC55.8070302@gmx.at> <200801300258.m0U2w9rr005169@sallyv1.ics.uci.edu> <47B9E0B1.1090908@gmx.at> <20080223224901.GB3476@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203813468 13470 80.91.229.12 (24 Feb 2008 00:37:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Feb 2008 00:37:48 +0000 (UTC) Cc: bug-cc-mode@gnu.org, martin rudalics , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 24 01:38:13 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JT4se-0004WR-Mv for ged-emacs-devel@m.gmane.org; Sun, 24 Feb 2008 01:38:13 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JT4s9-0005nL-DO for ged-emacs-devel@m.gmane.org; Sat, 23 Feb 2008 19:37:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JT4s5-0005n2-0P for emacs-devel@gnu.org; Sat, 23 Feb 2008 19:37:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JT4s3-0005m2-Fq for emacs-devel@gnu.org; Sat, 23 Feb 2008 19:37:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JT4s3-0005lu-Cm for emacs-devel@gnu.org; Sat, 23 Feb 2008 19:37:35 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JT4ry-0007zg-R3; Sat, 23 Feb 2008 19:37:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAK9LwEdMCpz5Wmdsb2JhbACQUQEgmnSBAA X-IronPort-AV: E=Sophos;i="4.25,396,1199682000"; d="scan'208";a="14890719" Original-Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 23 Feb 2008 19:37:17 -0500 Original-Received: from pastel.home ([76.10.156.249]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id ECJ76917; Sat, 23 Feb 2008 19:37:17 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 45F6F8A41; Sat, 23 Feb 2008 19:37:17 -0500 (EST) In-Reply-To: <20080223224901.GB3476@muc.de> (Alan Mackenzie's message of "Sat, 23 Feb 2008 22:49:01 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:90188 Archived-At: > ;-) I think that lisp.h is an ill-conditioned file, in some way. Or > are you telling me that the slowness happens in a lot of files.h? Basically, all .h files, tho clearly the slowdown is proportional to the distance between point-min and point. > The intolerability could be due to searching for an unnested brace > instead of one at column zero. Could be. Tho I don't see why it should be so slow, and if it is, then I'm convinced there's got to be some heuristic we could use to eliminate the O(N) complexity in practice. E.g. (re-search-backward "[;}][ \n\t]*\n[^ \t]") combined with a syntax-ppss check to make sure we're not inside a string/comment/parens. > Which files.h are you talking about, Stefan? CC Mode seems to work well > enough for me in my day job (maintaining typical old > "proprietary-quality" C code). Maybe .../src/lisp.h and one or two > others are somewhat extreme in their use of macros, or something. A My machine is not slow, but my Emacs is compiled with a fair bit of extra debugging checks, so it's equivalent to running on a slow machine. Still, the slowness is usually unnoticeable. Stefan PS: One other problem with add-log-current-defun is that it does not recognize function declarations any more (i.e. hitting C-x 4 a on a line like void foo (int); will fail to find the "foo" to put it in the ChangeLog). Not sure if it's related.