Using something like ...
@matched = grep /ABC/g, <FILE>;
On a single 16,000 line txt file takes only 0.7 seconds.
but, if I add ...
@matched = grep /ABC|XYZ/g, <FILE>;
On a single 16,000 line txt file takes 17.0 seconds.
Why would adding a alternate pattern sequence cause such an increase in execution time in perl?
Funny, though that when I test with and without alternate patterns using egrep, there's no difference in execution time - takes approx. 0.58 seconds for either one !!!
egrep "ABC|XYZ" file
@matched = grep /ABC/g, <FILE>;
On a single 16,000 line txt file takes only 0.7 seconds.
but, if I add ...
@matched = grep /ABC|XYZ/g, <FILE>;
On a single 16,000 line txt file takes 17.0 seconds.
Why would adding a alternate pattern sequence cause such an increase in execution time in perl?
Funny, though that when I test with and without alternate patterns using egrep, there's no difference in execution time - takes approx. 0.58 seconds for either one !!!
egrep "ABC|XYZ" file