Howto disassemble regex objects to compare performance

Viewed 30

Given the following string

1234

1234

We can use re.search(r'^\d{4}\Z') to find only the last four numbers or re.search(r'^\d{4}(?!\[\r\n\])'). How do I get a bytecode analysis (maybe with the dis module?) to compare which one is more effective? I know I could use timeit but am really interested in the internals.

0 Answers
Related