tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
411 stars 52 forks source link

feature: Add a performance comparison to the README #146

Open vassudanagunta opened 5 months ago

vassudanagunta commented 5 months ago

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

There is no problem. This is a feature request.

Describe the solution you'd like

It would be useful to see how well the parser generated from this Tree-sitter grammar performs against CMark and CommonMark.js.

Describe alternatives you've considered

No response

Additional context

No response

MDeiml commented 5 months ago

Note that this parser has a different goal than normal parsers like CMark and CommonMark. Usual parsers are optimized for parsing the file once and outputting a rendered document (for example in html). This tree-sitter parser on the other hand only aims to provide enough information for syntax highlighting, no rendering functionality is provided and the results are "less correct" than what other parsers produce. It is optimized for incremental scanning of the document. Meaning the first parse might be slower but all subsequent parses are fast (or at least that's the idea).

A performance comparison might still make sense since I guess you could also implement syntax highlighting using them, but usually the editors that use tree-sitter for syntax highlighting might not be adapted to doing that. I also expect this method to be quite slow for large files.

But it is unclear what could even be used for a comparison, as this parser does not render anything, which seems to be the basis for comparison at least in CommonMark.js.