py-tree-sitter icon indicating copy to clipboard operation
py-tree-sitter copied to clipboard

parsing, `keep_text` argument deprecated ?

Open juanmirocks opened this issue 1 year ago • 1 comments

Currently the keep_text argument is deprecated: https://github.com/tree-sitter/py-tree-sitter/blob/master/tree_sitter/init.pyi#L253

What is the reason for that? I ask because I've seen that parsing with keep_text=False makes it several times faster. There are valid occasions to do parsing without wanting to keep the text in the nodes.

If the argument will indeed be removed, what's the replacement? A Callable ?

Incidentally, the public docs do not warn about the deprecation: https://tree-sitter.github.io/py-tree-sitter/classes/tree_sitter.Parser.html

juanmirocks avatar Jul 26 '24 11:07 juanmirocks

Do you have any benchmarks?

ObserverOfTime avatar Jul 27 '24 18:07 ObserverOfTime

Thanks @ObserverOfTime and my bad for not answering in time. In the meantime, I saw the latest update removed the keep_text argument for good.

I just ran a benchmark on colab with still tree-sitter==0.22.3. I could not find at this time any significant difference in speed for setting keep_text to True vs. False.

So, all good from my side. Thank you!

juanmirocks avatar Nov 05 '24 11:11 juanmirocks