[Dbix-class] Why is prefetch so slow?

Brandon Black blblack at gmail.com
Wed Oct 17 21:43:29 GMT 2007


On 10/17/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Wed, Oct 17, 2007 at 04:19:24PM +0100, Nigel Metheringham wrote:
> > Jon,
> >
> > You should look at RH bug #196836 for information on the Red Hat
> > perl bug that causes this.
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=196836
>
> Is there any way we can detect our perl is affected by this?
>
> I'm loath to carve up DBIx::Class just to workaround Red Hat's stupidity but
> I'm also loath to leave our users unaware they're missing out on sensible
> performance.

The summarized background of the issue is:

1) Someone finds a real bug in 5.8.8
2) A fix is applied to the 5.8.x maintenance tree, but this fix has
the horrible performance issue
3) Redhat backports the patch from maint into their 5.8.8 release
4) Everyone complains
5) Another fix is applied to maint which keeps the original bug fixed
and also fixes the performance issue
6) Redhat backports this too, at least for some versions of the OS, if
you run the updates (not sure exactly which).

5.10 Already has a better fix for the original bug, and never had the
perf issue.

As far as I understand it from the first bug report here:
http://rt.perl.org/rt3/Public/Bug/Display.html?id=34925

.. you should be able to detect the existence of the original bug via:

----------------------

{ package TestRHBug; use overload bool => sub { 0 } }

sub has_bug_34925 {
    my %thing;
    my $r1 = \%thing;
    my $r2 = \%thing;
    bless $r1 => 'TestRHBug';
    return !!$r2;
}

sub possibly_has_bad_overload_performance {
    return $] < 5.008009 && ! has_bug_34925();
}

-------------

The "possibly..." sub above would return true for any 5.8.8
installation which had pre-applied the maint fixes related to the
original bug (Redhat), but it would also fail to distinguish a later
RedHat perl which had the second fix applied to fix up the
performance, hence the "possibly" in the name.

Another option is that maybe if we're luck (I have no RH system to
test on) RH puts the names of the patches it applied in %Config
somewhere (I believe there's an appropriate place, unless that's only
in blead versions), and we could then detect the RedHat case
specifically by RedHat's patch numbers, and only apply the workaround
where absolutely necc.

-- Brandon



More information about the DBIx-Class mailing list