From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Yates Newsgroups: gmane.emacs.devel Subject: Re: How can I predict which regions xdisp will present me for font-locking? Date: Mon, 12 Mar 2012 13:47:00 -0400 Message-ID: References: <20120311205903.GA3717@acm.acm> <83d38iyfox.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331574444 22840 80.91.229.3 (12 Mar 2012 17:47:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Mar 2012 17:47:24 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 12 18:47:23 2012 Return-path: Envelope-to: ged-emacs-devel@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 1S79L7-00022e-49 for ged-emacs-devel@m.gmane.org; Mon, 12 Mar 2012 18:47:21 +0100 Original-Received: from localhost ([::1]:54093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S79L6-0001fR-JO for ged-emacs-devel@m.gmane.org; Mon, 12 Mar 2012 13:47:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S79Kz-0001ei-0e for emacs-devel@gnu.org; Mon, 12 Mar 2012 13:47:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S79Kx-00020y-1X for emacs-devel@gnu.org; Mon, 12 Mar 2012 13:47:12 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:62501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S79Kp-0001zZ-5Q; Mon, 12 Mar 2012 13:47:03 -0400 Original-Received: by iajr24 with SMTP id r24so8096496iaj.0 for ; Mon, 12 Mar 2012 10:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=DzLstkdpZ+qJvNtMu2rEXYPvyUHMlDCGUPVXwjq4Pho=; b=l5Q3u23LcAJ/JZayLeRMzd5oye1SKAOrpg+ajYX0+Pq17i8F4vPJ77DGxYw5fIC7Rw ENLioWi6bdntxOWI5BJ3RIkrKjuWiJqVpjqOXDjQS2q/tecsu5/cdnNbLDm0T4GZrWAC tOnO1miMziOG9ubYRRvo7mDL98APVoAf0kvYkzSLBXakEJX9nmihZYhUErZR5rFNHzbQ p0H7y3iLzWRBb2zeY/ClJv6umvwtxU4KBGoYcZv4s1h2VAUgCKgCpUFThmlYW2zgNBAx XAk8bMRS12qORHUV3yVUGmR4gth6Qg0ayMLCUZCOIlieoDuFOUffajdlXEHKryjADVtQ rfYw== Original-Received: by 10.42.147.67 with SMTP id m3mr17400802icv.34.1331574420611; Mon, 12 Mar 2012 10:47:00 -0700 (PDT) Original-Received: by 10.231.133.199 with HTTP; Mon, 12 Mar 2012 10:47:00 -0700 (PDT) In-Reply-To: <83d38iyfox.fsf@gnu.org> X-Google-Sender-Auth: dep8LmL8ond5Z3cc44FIRWOLJnc X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.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:148979 Archived-At: On Sun, Mar 11, 2012 at 5:45 PM, Eli Zaretskii wrote: >> Date: Sun, 11 Mar 2012 20:59:03 +0000 >> From: Alan Mackenzie >> >> In a file.hpp, inside a 3355 line macro (I kid you not), I type a single >> character. =A0xdisp responds by presenting jit-lock, successively, with >> four areas to fontify. =A0(This was determined by >> trace-function-background on `font-lock-fontify-region'). >> >> None of these areas starts/stops at the top/bottom of the window. =A0It = is the >> third area which encloses the changed line. =A0The fourth area finishes >> below the window's last line. >> >> I can't see how this wierd sequence of fontification areas can be >> being calculated by CC Mode. >> >> This seemingly superfluous fontification seems to be causing a >> performance degradation. >> >> How can this series of fontification regions be explained? > > I think what happens is this: > > =A0. every change in the buffer triggers a call to > =A0 =A0font-lock-extend-jit-lock-region-after-change (via > =A0 =A0jit-lock-after-change-extend-region-functions) > > =A0. font-lock-extend-jit-lock-region-after-change extends the region > =A0 =A0of the change according to the font-lock properties of the major > =A0 =A0mode, then marks that region unfontified by putting on it a > =A0 =A0`fontified' text property with the value nil > > =A0. the next redisplay cycle calls jit-lock-function (via > =A0 =A0fontification-functions) at the beginning of the region whose > =A0 =A0`fontified' property is nil, and refontifies the region from there > =A0 =A0in chunks of 500 characters (but every chunk is extended so that > =A0 =A0its start is at the beginning of a line and its end is at the end > =A0 =A0of a line) > > Does this explain what you see? How does this strategy differ from 23.x? I am seeing a horrendous slowdown when editing atypical macros (though no more than 50 lines long). Worse still I see the same slowdown when editing a comment if even a fragment of my atypical macro is visible. The pattern of the macro is #define LIST_NAME \ _ROW_( ) \ , _ROW_( ) \ ... \ , _ROW_( ) \ /john