- or download this
...
$str .= $1 . $/ while ( $ARGV[0] =~ m/(.{3})/g );
...
- or download this
...
use constant LEN => 3;
...
$offset += $length;
}
...
- or download this
#!usr/bin/perl -w
use strict;
...
);
cmpthese($re);
- or download this
Benchmark: running regex, substring for at least 2 CPU seconds...
regex: 1 wallclock secs ( 2.09 usr + 0.00 sys = 2.09 CPU) @ 14
+030.14/s (n=29323)
...
Rate regex substring
regex 14030/s -- -40%
substring 23226/s 66% --
- or download this
...
$str .= $1 . $/ while ( $ARGV[0] =~ m/(.{3})/g ); ## NOTE the
+number 3
...
- or download this
...
$str .= $1 . $/ while ( $ARGV[0] =~ m/(.{LEN})/g ); ## NOTE 3
+is now LEN
...
- or download this
Benchmark: running regex, substring for at least 2 CPU seconds...
regex: 4 wallclock secs ( 2.72 usr + 0.01 sys = 2.73 CPU) @ 74
+0317.95/s (n=2021068)
...
Rate substring regex
substring 17333/s -- -98%
regex 740318/s 4171% --