- or download this
#!/usr/bin/perl
...
$m += ( 'a' eq substr $target, $_, 1 ) for 0 .. -2 + length $t
+arget;
},
});
- or download this
perl-5.38.2
==========
...
rindex 704/s 289% 192% 142% 131% 129% 80% 5%
+ 1% -- -96% -98%
split_by 16747/s 9166% 6845% 5665% 5403% 5360% 4177% 2387%
+2302% 2280% -- -51%
tr / y 34296/s 18876% 14124% 11707% 11170% 11081% 8658% 4994%
+4819% 4773% 105% --
- or download this
cmpthese(-1,{
'=()=' => sub { my $m = 0; $m = () = $target =~ m/ab/g; },
...
$m ++ while -1 < ( $pos = rindex $target, 'ab', $pos - $pat_le
+n );
},
});
- or download this
perl-5.38.2
...
index 814/s 119% 76% 70% 1% -- -3%
+ -92%
while 836/s 125% 81% 75% 4% 3% --
+ -91%
split_by 9752/s 2524% 2013% 1941% 1108% 1099% 1066%
+ --