all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Explain syntax-ppss-stats please
@ 2008-04-05 15:51 Lennart Borgman (gmail)
  2008-04-05 18:53 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-05 15:51 UTC (permalink / raw)
  To: Emacs Devel

I do not understand the use of syntax-ppss-stats at all. Where is it 
used? (I can only see that the 5:th element is read.) How does it work?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Explain syntax-ppss-stats please
  2008-04-05 15:51 Explain syntax-ppss-stats please Lennart Borgman (gmail)
@ 2008-04-05 18:53 ` Stefan Monnier
  2008-04-06  1:25   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2008-04-05 18:53 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

> I do not understand the use of syntax-ppss-stats at all. Where is it used?
> (I can only see that the 5:th element is read.) How does it work?

Only the 5th element is really used.  The rest was added there during
development to tune the algorithm.  It could be removed.

As for the 5th element it's used to keep track of the average size of
a "defun", so as to know whether to use the closest cache location, or
to try and find a closer location with syntax-begin-function: if the
closest cache location is 100KB earlier and syntax-begin-function
usually finds a safe point within 10KB, we're better off calling
syntax-begin-function (when tho it'll typically take a while itself)
than running parse-partial-sexp on the 100KB.  But OTOH if
syntax-begin-function usually needs to look back 200KB to find a safe
spot, then just the call to syntax-begin-function might take us longer
than just running parse-partial-sexp on the 100KB.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Explain syntax-ppss-stats please
  2008-04-05 18:53 ` Stefan Monnier
@ 2008-04-06  1:25   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-06  1:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Devel

Stefan Monnier wrote:
>> I do not understand the use of syntax-ppss-stats at all. Where is it used?
>> (I can only see that the 5:th element is read.) How does it work?
> 
> Only the 5th element is really used.  The rest was added there during
> development to tune the algorithm.  It could be removed.

Thanks. I still believe too much in magic. I thought something strange 
was going on somewhere behind the scenes.

Maybe this could be told in the code and the lines changing the other 
elements commented out?


> As for the 5th element it's used to keep track of the average size of
> a "defun", so as to know whether to use the closest cache location, or
> to try and find a closer location with syntax-begin-function: if the
> closest cache location is 100KB earlier and syntax-begin-function
> usually finds a safe point within 10KB, we're better off calling
> syntax-begin-function (when tho it'll typically take a while itself)
> than running parse-partial-sexp on the 100KB.  But OTOH if
> syntax-begin-function usually needs to look back 200KB to find a safe
> spot, then just the call to syntax-begin-function might take us longer
> than just running parse-partial-sexp on the 100KB.

Thanks, this was helpful.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-06  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-05 15:51 Explain syntax-ppss-stats please Lennart Borgman (gmail)
2008-04-05 18:53 ` Stefan Monnier
2008-04-06  1:25   ` Lennart Borgman (gmail)

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.