From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw. Date: Sat, 16 Dec 2006 13:14:49 -0500 Message-ID: <87bqm3btd2.fsf@stupidchicken.com> References: <45768797.5010106@gmx.at> <87odqhj89q.fsf@stupidchicken.com> <20061210014526.GB3738@muc.de> <877ix0lfm8.fsf@furball.mit.edu> <20061210102249.GA1235@muc.de> <87d56rpk7a.fsf@stupidchicken.com> <20061213224009.GA1206@muc.de> <87odq72ssy.fsf@stupidchicken.com> <20061214084713.GA1333@muc.de> <45812BDF.5050107@gmx.at> <4583C7D3.1070703@gmx.at> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1166292907 22361 80.91.229.10 (16 Dec 2006 18:15:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Dec 2006 18:15:07 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel@gnu.org, Stefan Monnier , Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 16 19:15:05 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1Gve3o-0005wh-Mk for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2006 19:15:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gve3o-0006KE-3h for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2006 13:15:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gve3Z-0006G2-LY for emacs-devel@gnu.org; Sat, 16 Dec 2006 13:14:45 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gve3U-0006CW-WD for emacs-devel@gnu.org; Sat, 16 Dec 2006 13:14:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gve3U-0006C8-Hi for emacs-devel@gnu.org; Sat, 16 Dec 2006 13:14:40 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gve3T-00050g-Hn; Sat, 16 Dec 2006 13:14:39 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 5ED594E44F; Sat, 16 Dec 2006 13:14:49 -0500 (EST) Original-To: martin rudalics In-Reply-To: <4583C7D3.1070703@gmx.at> (martin rudalics's message of "Sat\, 16 Dec 2006 11\:17\:55 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) 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:63837 Archived-At: martin rudalics writes: >>>M-> ran almost instantaneously before `beginning-of-defun-raw' changed. >>>And you did fill CC Mode's cache already before the change. I could >>>imagine it's because font-locking runs `beginning-of-defun' repeatedly >>>for decreasing buffer positions and the `syntax-ppss' cache doesn't >>>handle these cases optimally. >> >> I thought "no, can't be, 'cause I was careful to treat this correctly", so >> I went and measured it to give a clear proof of it, and much to my surprise >> you seemed to be right: >> >> And sure enough the problem was that in xdisp.c >> syntax-begin-function is not nil but set to c-beginning-of-syntax which >> doesn't make any sense: if you don't want to use a heuristic, then set the >> damn thing to nil. > > Jumping to the end of xdisp.c still takes four seconds. I continue to > feel puzzled. Note that Alan binds `syntax-begin-function' to nil in > his `beginning-of-defun-raw' hence why should this have any impact in > the first place? I must take another look in the basements of that. There is indeed something fishy going on: xdisp.c has 722096 characters, and (progn (goto-char 700000) (redisplay)) takes 0.25s (progn (goto-char 720500) (redisplay)) takes 0.28s (progn (goto-char 720522) (redisplay)) takes 0.26s (progn (goto-char 720550) (redisplay)) takes 2.34s (progn (goto-char 721000) (redisplay)) takes 2.24s (progn (goto-char 722096) (redisplay)) takes 2.31s Maybe a cache is overflowing somewhere.