Created
July 5, 2011 14:57
-
-
Save xaicron/1064997 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
my $regexp = qr/test/; | |
my @data = qw(Test foo Baz 2tesT); | |
my @lc_data = map { lc $_ } @data; | |
cmpthese -1 => { | |
ignore => sub { | |
$_ =~ /$regexp/i for @data; | |
}, | |
lc => sub { | |
lc($_) =~ /$regexp/ for @data; | |
}, | |
non => sub { | |
$_ =~ /$regexp/ for @data; | |
}, | |
lc_data => sub { | |
$_ =~ /$regexp/ for @lc_data; | |
} | |
}, 'all'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment