tree-sitter / tree-sitter-c

C grammar for tree-sitter
MIT License
225 stars 100 forks source link

feature: A C file that's strangely very slow to reparse #196

Open casouri opened 6 months ago

casouri commented 6 months ago

Did you check the tree-sitter docs?

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

Some user reported that editing a particularly huge C file is very very slow, in fact, orders of magnitude slower than I expect, so there might be something going on.

Download this file: https://raw.githubusercontent.com/wireshark/wireshark/master/epan/dissectors/packet-rrc.c

And find a function at the end of the file, say proto_register_rrc. make some edit in it, and try to incrementally reparse the file. It'll take ~30 seconds on my relatively new laptop. Even thought the file is large (10MB), it should't take ~30 seconds to reparse.

Describe the solution you'd like

Figure out why it is so slow to parse this file.

Describe alternatives you've considered

It might be some strange syntax used in the C file that caused the parser to operate very inefficiently. But I'm note sure

Additional context

No response