From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: C Mode: acceleration in brace deserts. Date: Thu, 3 Dec 2009 16:21:29 +0000 Message-ID: <20091203162129.GA1942@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259856988 31017 80.91.229.12 (3 Dec 2009 16:16:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Dec 2009 16:16:28 +0000 (UTC) To: Richard Stallman , Chong Yidong , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 03 17:16:21 2009 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 1NGELo-0007ZL-4y for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 17:16:16 +0100 Original-Received: from localhost ([127.0.0.1]:54378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGELn-0003UQ-RR for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 11:16:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGELi-0003U3-KK for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:16:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGELd-0003RE-Lc for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:16:09 -0500 Original-Received: from [199.232.76.173] (port=37330 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGELd-0003Qy-Ho for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:16:05 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:2830 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NGELc-0006XB-TD for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:16:05 -0500 Original-Received: (qmail 17467 invoked by uid 3782); 3 Dec 2009 16:16:02 -0000 Original-Received: from acm.muc.de (pD9E22654.dip.t-dialin.net [217.226.38.84]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Thu, 03 Dec 2009 17:16:01 +0100 Original-Received: (qmail 19128 invoked by uid 1000); 3 Dec 2009 16:21:29 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:118181 Archived-At: Hi, Richard, Yidong and Emacs! I have just committed my enhancements to CC Mode's `c-parse-state'. This is a central and critical part of Emacs which maintains a cache of the positions of certain braces, and fewer parens of other types. As the position of interest in a buffer moves, this cache is updated to reflect the new position. In the previous version, the cache handling was severely suboptimal in "brace deserts", large areas of buffers entirely lacking in braces. In the extreme, the algorithm was scanning from BOB every time c-parse-state was called. An example of such an extreme can be downloaded from . To see the effect, visit it, do M-> and try scrolling back a page at a time. Please compare the previous version with the new. The difference is noticeable even in our own .../src/lisp.h. It is now noticeably less sluggish when scrolling backwards from EOB. I have tested these changes thoroughly, principly by calculating c-parse-state successively at an infinite number (1000) of random points in the buffers lisp.h and xdisp.c, then comparing "old" results with "new" results. Many thanks to Stefan for `diff-refine-hunk' :-). If anybody notices anything odd, please let me know. -- Alan Mackenzie (Nuremberg, Germany).