I have been told that disabling backreferences in perl improves performance (provided you're not using them), and that if you don't use any backreferences perl will do this by itself.
Now I have a perl script with a large number of regex in it and only a single one uses a backreference and I would like to know the following:
- Given I have a very large number of regex (let's assuming most of my processing time is regex) does disabling back references a significant performance improvement? or are there criteria which I can use to know if this is the case?
- Is there a way I can disable backreferences once at the beginning and only reenable it when I need it (I know about
(?:
, but I don't want to have to add it to every grouping)? - Would scoping allow for perl to optimize this backreferencing behavior for me (ie. does a
sub
or aneval
change whether perl turns off backreferencing for things outside of it)?