Bug 253728

Summary: Use of perl overload can cause dramatic slowdown under Fedora 7
Product: [Fedora] Fedora Reporter: Markus Kuhn <mgk25>
Component: perlAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: 7CC: kasal, nigel, rc040203, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Fixed In Version: perl-5.8.8-28 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-13 03:35:03 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Markus Kuhn 2007-08-21 11:04:58 EDT
Description of problem:

Using the perl facility "use overload" together with blessing an object to the
class of the current module can cause a dramatic slow-down of Perl scripts
executed under Fedora 7. This problem does not occur with the identical Perl
release under SUSE Linux 10.2. A similar problem may also exist under Fedora Core 6.

Version-Release number of selected component (if applicable):

$ rpm -q perl
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Compiled at May 16 2007 23:23:14

How reproducible:

Easily and reliably reproducible.

Steps to Reproduce:
1. Save the test script

use overload q(<) => sub {};
my %h;
for (my $i=0; $i<50000; $i++) {
    $h{$i} = bless [ ] => 'main';
    print STDERR '.' if $i % 1000 == 0;

as an executable file "stour-test.pl".

2. Type

$ time ./stour-test.pl

and the program will print 50 dots.

The program should complete in less than 1 second, but takes much longer under
Fedora 7.

Actual results:

On a Fedora 7 installation:

real    1m40.613s
user    1m40.273s
sys     0m0.194s

On a SUSE 10.2 installation:

real    0m0.372s
user    0m0.344s
sys     0m0.020s

Both machines use identical hardware (1.4 GHz AMD Athlon, 1 GB RAM, same
motherboard). The runtimes under Fedora 7 become similar to those under SUSE
10.2 if either

  - the "use overload" line is uncommented
  - the string 'main' is changed to 'main1'

Expected results:

The runtime under Fedora 7 should be about 270x faster, similar to the one
achieved under SUSE 10.2 or with one of the above two modifications. There is no
reason, why loading "use overload" or changing the class into which we bless the
object should affect the runtime so dramatically.

Both Fedora 7 and SUSE 10.2 use Perl 5.8.8, so I strongly suspect that something
in the way the Fedora 7 Perl package has been prepared is causing this problem.
Comment 1 Nigel Metheringham 2007-10-17 10:39:05 EDT
Should be fixed in perl-5.8.8-22.fc8 or later

This duplicates Bug#196836
Comment 2 Robin Norwood 2007-10-17 11:20:34 EDT
Markus, can you try a perl later than perl-5.8.8-22 from fedora's rawhide to see
if that fixes your problem?

I can probably backport the fix to F7 if you want.  I'd like to hear that the
fix for bug#196836 actually fixes the problem first though.
Comment 3 Nigel Metheringham 2007-10-17 12:00:49 EDT
I've rebuilt perl-5.8.8-28.3 package on a Centos system.

The test script above works much quicker now, and real applications
built on Catalyst and DBIx-Class (which both tickle this bug)
are much nippier.

Not tested on F7 explicitly
Comment 4 Marcela Mašláňová 2008-03-13 03:35:03 EDT
Fixed also in F-7.