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

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

Thread Previous | Thread Next
Dave Mitchell
June 24, 2013 13:54
Re: [perl #118593] [PATCH 1/4] Fix docs about
Message ID:
On Sat, Jun 22, 2013 at 07:07:53AM -0700, Wallace Reis wrote:
> The performance penalty introduced by 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 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

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

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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About