Felix Geerinckx wrote:

> on Mon, 26 Aug 2002 19:01:27 GMT, David wrote:
> 
>> Felix Geerinckx wrote:
> 
>>> s/.*\[uuid (.*)\]/$1/;
>> 
>> this might be a bit faster:
>> 
>> /(\S+).$/
> 
> 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)

search_assign:  ($_) = /(\S+).$/;
search_replace: s/.*\[uuid (.*)\]/$1/;

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to