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

[perl #50250] perl5.10.0: pos function is much slower with "progressive match" and unicode

Thread Next
From:
Heinz Knutzen
Date:
January 25, 2008 15:42
Subject:
[perl #50250] perl5.10.0: pos function is much slower with "progressive match" and unicode
Message ID:
rt-3.6.HEAD-11076-1201299622-610.50250-75-0@perl.org
# New Ticket Created by  Heinz Knutzen 
# Please include the string:  [perl #50250]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50250 >


Hello,

the parser of netspoc (http://netspoc.berlios.de) runs 4 times slower 
with perl5.10.0 than with perl5.8.8.

I tracked this down to a small test case:

perl -e 'print "x"x200000'>large
time perl5.8.8 -C -e '$_=<>;while(1){/\G./g;pos||last;}' large
time perl5.10.0 -C -e '$_=<>;while(1){/\G./g;pos||last;}' large

On my computer with AMD Athlon BE-2350 I get these results:
perl5.8.8:    0.25 seconds
perl5.10.0: 490.00 seconds
--> a factor of nearly 2000!

The problem doesn't appear
- if unicode isn't enabled or
- if pos() is run without progessive matching.

Attached you will find the output of "perl -V" for both versions of perl.

-- 
Heinz Knutzen


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