develooper Front page | perl.perl5.porters | Postings from January 2008

Slowdown in 5.10.0 regexes with atomic patterns

Thread Next
From:
Moritz Lenz
Date:
January 28, 2008 07:47
Subject:
Slowdown in 5.10.0 regexes with atomic patterns
Message ID:
479DE845.20803@casella.verplant.org
Following up on a perlmonks thread: http://www.perlmonks.org/?node_id=664545

Summary: some regexps with atomic groups are much slower on 5.10.0 than
on 5.8.

#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw(cmpthese);

my $str = "bea" x 100;
my $re = qr/(?:be|ea|a)/;
cmpthese(-2, {
	atomic    => sub { die if $str =~ m/(?>$re+)\d/ },
	normal    => sub { die if $str =~ m/$re+\d/ },
#	posessive => sub { die if $str =~ m/$re++\d/ }, # only for >5.8
});


$ perl5.10.0 bench.pl
         Rate atomic normal
atomic 89.6/s     --   -97%
normal 2764/s  2984%     --

on 5.10 the possessive quantifier gives the same result as the atomic group.

(blead@33087 gives similar results).
Both outputs are from non-debugging perls.

Andreas, could you please use your magic binary search to find out which
patch introduced the slowdown?


Cheers,
Moritz

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