ocehb: (Default)
ocehb ([personal profile] ocehb) wrote 2012-01-20 09:23 am (UTC)

s#\+(\d)#$1#g, только первый вариант в ~2 раза быстрее:

# perl -MBenchmark=cmpthese -e \
  '$aa = shift; cmpthese($ARGV[0],
     { ''A'' => sub { my $bb = $aa; $bb =~ s#\+(?=\d)##g },
       ''B'' => sub { my $bb = $aa; $bb =~ s#\+(\d)#$1#g } } )' "+test + +12 +13 +14 +100 ++" 1024000
      Rate    B    A
B 195420/s   -- -50%
A 393846/s 102%   --
#

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org