on Mon, 26 Aug 2002 19:53:44 GMT, David wrote:
> Felix Geerinckx wrote:
>
>> If you claim something is faster, prove it ;-)
>> (But remember, the OP wanted the result in $_).
>>
>
> i only suggest that it might be faster. :-)
> i won't go into too much detail to try to prove that. i only ran the
> following:
>
> #!/usr/bin/perl -w
> use strict;
> use Benchmark;
>
> my @t = timethese(999999,{'search_assign' =>
> '$_ = \'vws [uuid 1234.abcd]\';($_) = /(\S+).$/;',
> 'search_replace' =>
> '$_ = \'vws [uuid 1234.abcd]\';s/.*\[uuid (.*)\]/$1/;'});
>
> gives:
>
> Benchmark: timing 999999 iterations of search_assign, search_replace...
> search_assign: 21 wallclock secs (10.22 usr + 0.00 sys = 10.22 CPU) @
> 97847.26/s (n=999999)
> search_replace: 34 wallclock secs (16.49 usr + 0.02 sys = 16.51 CPU) @
> 60569.29/s (n=999999)
Now you're talking.
But just for the fun of it, run the benchmark again with the OP's original
(much longer) string ... ;-)
--
felix
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]