Bug 253728 - Use of perl overload can cause dramatic slowdown under Fedora 7
Summary: Use of perl overload can cause dramatic slowdown under Fedora 7
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 7
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2007-08-21 15:04 UTC by Markus Kuhn
Modified: 2008-03-13 07:35 UTC (History)
4 users (show)

Fixed In Version: perl-5.8.8-28
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-03-13 07:35:03 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Bugzilla 196836 None None None Never

Description Markus Kuhn 2007-08-21 15:04:58 UTC
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 14:39:05 UTC
Should be fixed in perl-5.8.8-22.fc8 or later

This duplicates Bug#196836

Comment 2 Robin Norwood 2007-10-17 15:20:34 UTC
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 16:00:49 UTC
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 07:35:03 UTC
Fixed also in F-7.

Note You need to log in before you can comment on or make changes to this bug.