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: Re: bug#20352: Factor 2 slow down of font-locking in c-mode Date: Mon, 4 May 2015 10:33:38 +0000 Message-ID: <20150504103338.GA3902@acm.fritz.box> References: <20150417191005.4119.qmail@mail.muc.de> <20150418094552.GA4182@acm.fritz.box> <20150503213303.GA4997@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1430735653 3105 80.91.229.3 (4 May 2015 10:34:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 May 2015 10:34:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 04 12:34:05 2015 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 1YpDhL-00055V-H0 for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 12:34:03 +0200 Original-Received: from localhost ([::1]:33556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpDhF-0000mm-Un for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 06:33:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpDgx-0000ks-3Z for emacs-devel@gnu.org; Mon, 04 May 2015 06:33:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpDgr-0003z2-Te for emacs-devel@gnu.org; Mon, 04 May 2015 06:33:39 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:43234 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpDgr-0003yX-KQ for emacs-devel@gnu.org; Mon, 04 May 2015 06:33:33 -0400 Original-Received: (qmail 19661 invoked by uid 3782); 4 May 2015 10:33:29 -0000 Original-Received: from acm.muc.de (p548A4DEC.dip0.t-ipconnect.de [84.138.77.236]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 04 May 2015 12:33:27 +0200 Original-Received: (qmail 4096 invoked by uid 1000); 4 May 2015 10:33:38 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.1 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:186177 Archived-At: Hello, Stefan. On Sun, May 03, 2015 at 10:13:48PM -0400, Stefan Monnier wrote: > > Indeed. Some while ago, you were musing on putting syntax-ppss, or > > equivalent, into syntax.c, thus rendering > > open-paren-in-column-0-is-defun-start unnecessary and obsolete. This > > would speed up or improve the accuracy of, in particular, back_comment > > and the stacks of things which depend upon it. > > Is this enhancement still intended? > Not in the short term, no. I've toyed with it, but there's a problem: > syntax-ppss's caching relies on the syntax-table being constant. > This usually works fine because the callers "know" to call syntax-ppss > outside of with-syntax-table (I guess in reality they don't really know, > but they happen to do that because they call syntax-ppss fairly early > on), but it's not uncommon for Elisp code (definitely including CC-mode) > to use with-syntax-table around calls to forward-sexp/comment, so > calling syntax-ppss implicitly from within those functions exposes this > underlying syntax-ppss limitation. Ah. That sounds like a shame. > IOW, it can't be done until we figure out how to make syntax-ppss handle > syntax-table changes. How about having an association list of ((syntax-table . cache) ...), or something like that? Each cache would need its own value of the equivalent of `syntax-propertize--done'. `modify-syntax-entry' would need to wipe the cache. Then there are `category' text properties/overlays which might affect the syntax. And so on. And so on. OK. It's difficult. > Stefan -- Alan Mackenzie (Nuremberg, Germany).