- or download this
#!/usr/local/bin/perl -w
use strict;
...
);
exit;
- or download this
Benchmark: timing 500000 iterations of Method One UC, Method Three s,
+Method Two TR...
Method One UC: 1 wallclock secs ( 1.42 usr + 0.00 sys = 1.42 CPU) @
+ 352112.68/s (n=500000)
Method Three s: 16 wallclock secs (17.03 usr + 0.00 sys = 17.03 CPU)
+@ 29359.95/s (n=500000)
Method Two TR: 1 wallclock secs ( 2.04 usr + 0.00 sys = 2.04 CPU) @
+ 245098.04/s (n=500000)
- or download this
my $data = 'for-bar-baz';
$data =~ s/-/_/g;
...
my $data = 'for-bar-baz';
$data =~tr/-/_/;
print $data;
- or download this
Benchmark: timing 500000 iterations of Method One TR, Method Two s...
Method One TR: 2 wallclock secs ( 1.87 usr + 0.00 sys = 1.87 CPU) @
+ 267379.68/s (n=500000)
Method Two s: 5 wallclock secs ( 4.84 usr + 0.00 sys = 4.84 CPU) @
+103305.79/s (n=500000)