Red Hat's patch slows down overloading in Perl
Vipul Ved Prakash, long-time CPAN author and creator of Vipul's Razor, has reported a big slowdown in Red Hat's Perl package.
Some investigation revealed that there’s a long standing bug in Redhat Perl that causes *severe* performance degradation on code that uses the bless/overload combo. The thread on this is here: https://bugzilla.redhat.com/show_bug.cgi?id=379791.
Vipul's analysis is a beautiful rundown of how these kinds of things should be reported, and the techie details should help you decide whether you want to rebuild Perl from source, or wait for updated packages for RHEL and Fedora.
Pete Krawczyk sent me a few comments:
RedHat acknowledges that their patching of Perl caused slowness; if you're doing serious work with default Perl on RedHat, you might want to consider building your own until a proper patch comes along. The problem currently affects Fedora 9, RedHat 5 and spin-offs like CentOS 5. The main symptom is exponential slowdown during operations involving overloaded operators; many common modules (such as JSON and URI) are also affected.
Some other links:
And here's my code to illustrate the slowdown, based on the original code in Vipul's article:
#!/usr/bin/perl
use Time::HiRes;
use overload q(<) => sub {};
my %h;
$|++;
print "Pass#\tPass time\tTotal time\n";
my $bigstart = Time::HiRes::time();
for my $i ( 1..50 ) {
my $start = Time::HiRes::time();
for my $j ( 1..1000 ) {
$h{$i*1000 + $j} = bless [ ] => 'main';
}
my $now = Time::HiRes::time();
printf( "#%2d\t%f\t%f\n", $i, $now-$start, $now-$bigstart );
}
Categories
Perl 54 Comments
Leave a comment
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)
I'm shocked, shocked to find that Redhat has screwed up Perl again!
err... For quite some time DBIx::Class warns people about this.
Check http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/StartupCheck.pm
Its not the same bug id but it feels the same.
And Fedora 9:
Nick's blog post on the issue seems to back this up too.
The title of this post is a bit off. What is slowed down is object creation, for objects that do overloading. It's not the overloading itself that is slowed down. If it were just that, it'd be a much smaller problem.