[Top][All Lists]

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

Re: How to add pseudo vector types

From: Stefan Monnier
Subject: Re: How to add pseudo vector types
Date: Sat, 17 Jul 2021 13:30:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

In your benchmark , you give numbers for:
- initial full-text parse (a bit above 1MB/s)
- cost of update-without-reparse

but I think it would be nice to see the cost of the reparse after
those updates (should be much faster than the initial parse).

Clément said:
> I have no idea if it makes sense, but: does the initial parse need to be
> synchronous, or could you instead run the parsing in one thread, and the
> rest of Emacs in another? (I'm talking about concurrent execution, not
> cooperative threading).

If we copy the buffer's content to a freshly malloc area before passing
that to TS, then there should be no problem running TS in a separate
concurrent thread, indeed.

Eli said:
> Why do you update the entire parser list for every modification?
> This comment:

If having multiple parsers in a single buffer is a not-uncommon case,
then indeed we'll need to do better, but if we assume this is an
anomalous situation, then Yuan's code is optimal ;-)

> Yes, I think we should only ask TS to parse what we need, not more.

We'll need to experiment with that.  Using an approach like
`syntax-ppss` where we only parse up to some high-watermark might be
a good approach, but it's also possible that it will work poorly: if TS
assumes it works on the whole buffer, then it will see the truncated
text as a syntax error and while it is supposed to handle syntax errors
nicely it may still lead to suboptimal behavior when parts of perfectly
valid code is misparsed because the parser was not allowed to see the
closing braces that make it "perfectly valid".


reply via email to

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