develooper Front page | perl.perl5.porters | Postings from November 2014

[perl #123202] Slow global pattern match in taint mode with input from utf8

Thread Previous
From:
Heinz Knutzen
Date:
November 13, 2014 20:48
Subject:
[perl #123202] Slow global pattern match in taint mode with input from utf8
Message ID:
rt-4.0.18-27973-1415899033-1951.123202-75-0@perl.org
# New Ticket Created by  Heinz Knutzen 
# Please include the string:  [perl #123202]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123202 >


There is a massive slowdown in global pattern match with Perl 5.20.1 in 
taint mode.
This is a follow up to bug #120692.
That has been fixed, but the bug still occurs with taint mode enabled.

Create test data with this shell command line:
$ for i in $(seq 1 20000) ; do echo -n ab; done > abab

$ perlbrew use perl-5.20.1
$ /usr/bin/time -f '%Us' perl -Ci -e '$in = <>;while ($in =~ m/\Ga+b/g) 
{}' abab
0.02s
$ /usr/bin/time -f '%Us' perl -T -Ci -e '$in = <>;while ($in =~ 
m/\Ga+b/g) {}' abab
12.14s
$ perlbrew use perl-5.18.4
$ /usr/bin/time -f '%Us' perl -Ci -e '$in = <>;while ($in =~ m/\Ga+b/g) 
{}' abab
0.02s
$ /usr/bin/time -f '%Us' perl -T -Ci -e '$in = <>;while ($in =~ 
m/\Ga+b/g) {}' abab
0.02s

This slowdown also appears with Perl 5.21.5.

I had to revert an upgrade of a production system from 5.16.3 to 5.20.1 
today, because of this bug.


Thread Previous


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