[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with syntax-ppss

From: Stefan Monnier
Subject: Re: Problems with syntax-ppss
Date: Sat, 05 Apr 2008 14:37:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> >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.


> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]