I realized that my previous post had the wrong comparison. Here's one
that's short and to the point:

  re1  => q($str = '     259.00 '; $str =~ s/\s(?=\s*\S)/0/g;),
  re2  => q($str = '     259.00 '; $str =~ s/ (?= *\d)/0/g;),

Benchmark: timing 1000000 iterations of re1, re2...
       re1:  3 wallclock secs ( 4.08 usr +  0.00 sys =  4.08 CPU) @
245218.24/s (n=1000000)
       re2:  4 wallclock secs ( 4.69 usr +  0.00 sys =  4.69 CPU) @
213310.58/s (n=1000000)

        Rate  re2  re1
re2 213311/s   -- -13%
re1 245218/s  15%   --

Using a space is about 15% slower than using \s. Weird, huh?

- Mark.


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to