From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Problems with syntax-ppss Date: Sat, 05 Apr 2008 14:37:39 -0400 Message-ID: References: <20080404172627.GB4804@muc.de> <47F69A4F.1050405@gmx.at> <20080405144642.GA3095@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1207420679 31639 80.91.229.12 (5 Apr 2008 18:37:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2008 18:37:59 +0000 (UTC) Cc: martin rudalics , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 05 20:38:31 2008 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 1JiDHa-000343-OB for ged-emacs-devel@m.gmane.org; Sat, 05 Apr 2008 20:38:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JiDGx-0004xf-Hh for ged-emacs-devel@m.gmane.org; Sat, 05 Apr 2008 14:37:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JiDGo-0004us-Kh for emacs-devel@gnu.org; Sat, 05 Apr 2008 14:37:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JiDGm-0004uC-W9 for emacs-devel@gnu.org; Sat, 05 Apr 2008 14:37:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JiDGm-0004u7-Lo for emacs-devel@gnu.org; Sat, 05 Apr 2008 14:37:40 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JiDGm-0003Jo-D3 for emacs-devel@gnu.org; Sat, 05 Apr 2008 14:37:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0BAPdi90fO+J/WdGdsb2JhbACBXI94ASqYUg X-IronPort-AV: E=Sophos;i="4.25,609,1199682000"; d="scan'208";a="17872145" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 05 Apr 2008 14:37:39 -0400 Original-Received: from pastel.home ([206.248.159.214]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id LWQ92239; Sat, 05 Apr 2008 14:37:39 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 94D827F85; Sat, 5 Apr 2008 14:37:39 -0400 (EDT) In-Reply-To: <20080405144642.GA3095@muc.de> (Alan Mackenzie's message of "Sat, 5 Apr 2008 14:46:42 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:94429 Archived-At: >> >I strongly recommend to always call syntax-ppss in a widened buffer. >> ... and with match-data saved. > Er, your replies don't exactly radiate an aura of confidence about > syntax-ppss. ;-( > I think you (Stefan) 're saying that the function isn't 100% defined for > a narrowed buffer. Indeed. > Will calling s-ppss on a narrowed buffer corrupt the > cache at all, for example? Yes it can. Similarly the cache does not keep track of the syntax-table so if you switch syntax-table between calls you may get unexpected results. > As a matter of interest, are there any benchmark figures for s-ppss? I did time it in various circumstances when writing it (so as to tune its algorithm). > Like, how many characters do you have to scan more than, before s-ppss > (an interpreted lisp function) starts being faster than > (parse-partial-sexp 1 (point)) (a fast function written in C)? I can't remember exactly, but syntax-ppss-max-span was set based on these measurements, so it gives you an idea. Note that there are two different caches: there's syntax-ppss-cache which is affected by syntax-ppss-max-span and is only really useful for large buffers, and there's syntax-ppss-last which benefit from spatial locality. Stefan