develooper Front page | perl.perl5.porters | Postings from June 2013

Re: [perl #118593] [PATCH 1/4] Fix docs about English.pm

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
June 24, 2013 13:54
Subject:
Re: [perl #118593] [PATCH 1/4] Fix docs about English.pm
Message ID:
20130624134920.GF2128@iabyn.com
On Sat, Jun 22, 2013 at 07:07:53AM -0700, Wallace Reis wrote:
> The performance penalty introduced by English.pm for regular
> expressions was fixed in 5.18, so update docs about it (without
> needing to use "-no_match_vars" special flag) and pointing
> to English.pm docs where necessary.

Actually that's not strictly true.
The full fix for $`,$&,$' performance issues involves the new COW
mechanism, which was disabled by default in 5.18 (and enabled by default
in 5.19.1).

5.18.0 has a partial fix, where it records the presence of the three vars
separately.

So in 5.18.0, this is fast:

    perl5180o -e'$&; $a="a"x1_000_000; 1 while $a =~ /a/g;'

this is extremely slow:

    perl5180o -e'$`; $a="a"x1_000_000; 1 while $a =~ /a/g;'

On 5.19.1, they're both fast.

Even if had been fixed in 5.18.0, I think that the text in perlvars
warning that in older versions the puncuation vars are slow, should be
kept.


-- 
"There's something wrong with our bloody ships today, Chatfield."
    -- Admiral Beatty at the Battle of Jutland, 31st May 1916.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About