From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#16526: 24.3.50; scroll-conservatively & c-mode regression Date: Sat, 28 Jun 2014 14:55:09 +0000 Message-ID: <20140628145509.GB4144@acm.acm> References: <20140205230001.GB3381@acm.acm> <8338jw230j.fsf@gnu.org> <83wqc8sxd2.fsf@gnu.org> <20140625213206.GA3604@acm.acm> <20140627203416.GA4395@acm.acm> <20140628130059.GA4144@acm.acm> <53AECA88.7010401@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1403967762 32230 80.91.229.3 (28 Jun 2014 15:02:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Jun 2014 15:02:42 +0000 (UTC) Cc: 16526-done@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 28 17:02:35 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X0u9A-00058z-BX for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jun 2014 17:02:32 +0200 Original-Received: from localhost ([::1]:54966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0u99-0002Sg-Vi for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jun 2014 11:02:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0u8z-0002SU-49 for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 11:02:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0u8r-00014l-L4 for bug-gnu-emacs@gnu.org; Sat, 28 Jun 2014 11:02:21 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0u6m-0000CB-JV; Sat, 28 Jun 2014 11:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X0u6l-0004H6-M9; Sat, 28 Jun 2014 11:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 28 Jun 2014 15:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16526 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 16526-done@debbugs.gnu.org id=D16526.140396758816376 (code D ref 16526); Sat, 28 Jun 2014 15:00:03 +0000 Original-Received: (at 16526-done) by debbugs.gnu.org; 28 Jun 2014 14:59:48 +0000 Original-Received: from localhost ([127.0.0.1]:36264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X0u6V-0004G3-V9 for submit@debbugs.gnu.org; Sat, 28 Jun 2014 10:59:48 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:12047 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X0u6R-0004Fr-Gd for 16526-done@debbugs.gnu.org; Sat, 28 Jun 2014 10:59:44 -0400 Original-Received: (qmail 93200 invoked by uid 3782); 28 Jun 2014 14:59:41 -0000 Original-Received: from acm.muc.de (pD951AE09.dip0.t-ipconnect.de [217.81.174.9]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 28 Jun 2014 16:59:38 +0200 Original-Received: (qmail 4949 invoked by uid 1000); 28 Jun 2014 14:55:09 -0000 Content-Disposition: inline In-Reply-To: <53AECA88.7010401@gmx.at> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:90938 Archived-At: Hi, Martin. On Sat, Jun 28, 2014 at 04:00:40PM +0200, martin rudalics wrote: > > AH!!!!! GOT IT!!!! What causes the slowdown is binding > > open-paren-in-column-0-is-defun-start to nil around the scan-lists. In > > CC Mode's "engine" parts, that variable is bound to nil. There are good > > reasons for this (which I can't precisely recall just at the moment). > > In CC Mode, "'" has string syntax. So any C comment with an odd number > > of apostrophes looks, to back_comment, like it has an "unbalanced string", > > and the code ends up at label lossage: in back_comment. Here > > find_defun_start is called, and this returns BOB when open-paren-..-0 is > > nil. From here (BOB) the code scans forward to check this putative > > "unbalanced string". It's a long way from BOB to ~900k, hence the > > sluggishness. > > Where do we go from here? > In every version of Emacs I'm actually doing some work I have disabled > CC mode's `open-paren-in-column-0-is-defun-start' bindings. This is harmless (and thus helpful) in code conforming to GNU standards. As you note below, it causes confusion and heartache in other circumstances. > Otherwise, working on a file like xdisp.c would be virtually impossible > for me. As for the release I would simply do what I proposed earlier - > make these overriding bindings customizable. I'd far rather the code worked properly (including fast enough). Making a choice between two ugly workarounds customisable would be short-changing users. > So someone who wants to comment out code with a paren in the first > column can have the "correct" behavior while people like me can > continue work with "incorrect" but yet tame behavior. And obviously I > could continue to work without having bzr status tell me that I've > changed CC mode files ;-) This particular scan-lists which took 0.7s had to traverse 65 comments, of which 29 had an odd number of apostrophes. Scanning xdisp.c from BOB to syms_of_xdisp on my machine takes 0.024s. 28 * 0.024s = 0.67s. So if there were simple cacheing in syntax.c, such that the scan from BOB was done at most once for each scan-lists, the sluggishness would largely vanish in this case. If you look at find_defun_start in syntax.c, you'll be struck by just what an ugly kludge the code for null open_paren_.._start is. Substantial improvement must surely be possible. > martin -- Alan Mackenzie (Nuremberg, Germany).