Closed ldunham1 closed 2 years ago
Thanks! I moved all looping matches to compile 5b6eb65e3caa0be277105706a9a6881b525626b3
From what I read on the subject briefly is that compile gets called internally automatically on match
and findall
, but making it explicit like this might be a bit faster :)
Yes exactly, it's compiled when the functions are called but precompiling the patterns is usually a good shout when you're compiling the same pattern in a loop :)
https://github.com/friedererdmann/pymxs_stubs/blob/5f793a81fc621c5ed56dc6c4193cf8f4097bc921/parser.py#L61 Generally I like to pre-compile where possible to reduce overhead. Not a big thing here, but it can noticeably improve performance for lots of iterations.