in reply to Re^3: Remove all non alphanumeric characters excluding space, underscore and minus sign (Benchmark--)
in thread Remove all non alphanumeric characters excluding space, underscore and minus sign
There's still another "tiny mistake" with your code, which is that the following snippet doesn't generate a string of length 1024001, but a string of length 1:
my $string = pack "A*" => map { chr (32 + int rand 95) } 0..1024000; print length($string);
Done properly, i.e. either using pack "(A)*", ..., or join '', ..., or the much more memory-friendly
my $string; $string .= chr(32 + int rand 95) for 0..1024000;
I get the following quite different results:
Rate subsingle subplus tran subsingle 18.5/s -- -15% -93% subplus 21.9/s 18% -- -92% tran 268/s 1345% 1121% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Remove all non alphanumeric characters excluding space, underscore and minus sign (Benchmark--)
by tye (Sage) on Feb 13, 2012 at 20:01 UTC | |
by Tux (Canon) on Feb 13, 2012 at 22:22 UTC |