tree-sitter-clojure
tree-sitter-clojure copied to clipboard
Cost of use of `inline` unknown
There's a claim that using inline can be costly in some cases: https://github.com/tree-sitter/tree-sitter/issues/2078#issuecomment-1421932361
We started using inline recently: https://github.com/sogaiu/tree-sitter-clojure/blob/262d6d60f39f0f77b3dd08da8ec895bd5a044416/grammar.js#L208-L215
I think we speculated about using inline further, for example, for things like this: https://github.com/sogaiu/tree-sitter-clojure/blob/262d6d60f39f0f77b3dd08da8ec895bd5a044416/grammar.js#L357-L361
So may be we'll remember to think of the potential cost issue when considering and experimenting with carrying out such changes.
Not sure how to asses it, but perhaps it's worth investigating it at some point.
Maybe we run some performance tests with and without that inline directive, see what they turn up?
That sounds reasonable.
We might not notice a difference but it could be that the generate subcommand duration might differ as well.
I suspect that for our small grammar it's not likely to be a big deal, but I've seen tree-sitter-c-sharp's case take more than 4 minutes. Memory use was over 50GB as well.
We're lucky that clojure has such simple syntax rules I think. Ours is one of the smallest grammars I have encountered, and probably one of the fastest.