in reply to Re^2: Matching simple patterns - is there a faster way?
in thread Matching simple patterns - is there a faster way?
As requested ( I typed this in from the code ):
I have found 'index' usually faster than 'regex' in this type of situation, but 'regex' has more power when needed.sub index { if ( index('yabba dabba doo','abba' ) >= 0 ) { } } sub regex { $_ = 'yabba dabba doo'; if ( /abba/ ) { } } cmpthese ( 500_000, { regex => sub { ®ex }, index => sub { &index }, }, );
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|
---|