[Top][All Lists]

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

font-lock and syntax-ppss

From: Stefan Monnier
Subject: font-lock and syntax-ppss
Date: Sun, 28 Oct 2001 01:54:58 -0400

I've just committed a patch to font-lock in the CVS repository
that makes it use `syntax-ppss'.  But syntax-ppss might need
more tuning, so please before exiting your Emacs session (if
you ever do so) or "every once in a while" do

        M-x elp-results RET

to see the comparison between syntax-ppss and font-lock-ppss.
If it turns out that font-lock-ppss was (on average) faster
than syntax-ppss, please send me the content of the elp buffer
together with the output from M-: (syntax-ppss-stats) RET
and the content of font-lock-ppss-stats while you're at it.

Note that by "faster" I mean more than just 5-10% (unless it's
almost always slightly faster): after all `syntax-ppss' is not
meant to be really faster on average, but just to reduce the
occurences of pathological cases.

When font-lock refreshes a part of the buffer, it needs to know
what state it's starting from (whether the beginning of the area
is within a string or comment or neither, basically).

Until now, it did it with a fairly simple approach that used a very
simple cache.  The approach was simple but pretty effective in
"normal" situations.  But with lazy-lock and jit-lock, the notion
of "normal" has slightly changed and it is more common to see
pathological behavior.  For an example, open a really large
sh script, jump to the very end and then scroll backwards a few

`syntax-ppss' tries to be a bit more clever in its caching
so as to reduce the occurence of those pathological cases
(the M-> part will still be slow, but the M-v parts should be faster,
although you won't see the difference just now since the code
currently calls both syntax-ppss and the old simple code).

In typical use, syntax-ppss is not really faster on the average and
risks being slower because of added overhead, but it should be possible
to tune it enough to make it about as fast (it's generally faster
for me, but then it's been tuned for my particular use ;-).

Also, you might see different number of calls to syntax-ppss
than to font-lock-ppss because syntax-ppss is also used by a
few other packages (sh-script and awk-mode, IIRC).


reply via email to

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