neogeny / TatSu

竜 TatSu generates Python parsers from grammars in a variation of EBNF
https://tatsu.readthedocs.io/
Other
403 stars 48 forks source link

Pre-compile regexps #338

Closed olejorgenb closed 4 months ago

olejorgenb commented 4 months ago

Note: This is untested and I don't have time/energy to do any more on this, so if no one wants to wrap it up, feel free to close it.

Noticed this while profiling ics-py which felt really slow (even considering large ics files and it being python).

Would speed up https://github.com/ics-py/ics-py 3% ~7% so not that much, but maybe worth a few line changes.

image (the 4 first call-sites are related to the comment regexs)

(github refuse to upload the py-spy profile..)