8 # This is a rather unusual test.
9 # It does not test any aspect of DBIx::Class, but instead tests the
10 # perl installation this is being run under to see if it is:-
11 # 1. Potentially affected by a RH perl build bug
12 # 2. If so we do a performance test for the effect of
15 # You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
18 # If these tests fail then please read the section titled
19 # Perl Performance Issues on Red Hat Systems in
20 # L<DBIx::Class::Manual::Troubleshooting>
23 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
24 if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
27 plan skip_all => 'needs Benchmark for testing' if $@;
32 package # don't want this in PAUSE
34 use overload bool => sub { 0 }
41 bless $r1 => 'TestRHBug';
45 sub _possibly_has_bad_overload_performance {
46 return $] < 5.008009 && !_has_bug_34925();
49 ok( !_possibly_has_bad_overload_performance(),
50 'Checking not susceptable to bless/overload performance problem' );
52 my $results = timethese(
56 use overload q(<) => sub { };
58 for ( my $i = 0 ; $i < 5000 ; $i++ ) {
59 $h{$i} = bless [] => 'main';
64 for ( my $i = 0 ; $i < 5000 ; $i++ ) {
65 $h{$i} = bless [] => 'main';
71 ok( ( ( $results->{nooverload}->iters / $results->{overload}->iters ) < 2 ),
72 'Overload/bless performance acceptable' )