X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fzzzzzzz_perl_perf_bug.t;h=a9cc07f7e021a0d5684690f05c5309f9e2103bdc;hb=f064a2abb15858bb39a141ad50391d4191988d2c;hp=c0a96d8d274d90d67f2b9e220f8f781d9fa69f6f;hpb=8d6b1478d8fa6f7c76e313ee72a72d5eb4c24d03;p=dbsrgits%2FDBIx-Class.git diff --git a/t/zzzzzzz_perl_perf_bug.t b/t/zzzzzzz_perl_perf_bug.t index c0a96d8..a9cc07f 100644 --- a/t/zzzzzzz_perl_perf_bug.t +++ b/t/zzzzzzz_perl_perf_bug.t @@ -1,10 +1,27 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; -use Benchmark; -use lib qw(t/lib); + + +BEGIN { + delete $ENV{DBIC_ASSERT_NO_ERRONEOUS_METAINSTANCE_USE}; + + plan skip_all => + 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set' + if ( $ENV{DBIC_NO_WARN_BAD_PERL} ); + + require DBICTest::RunMode; + plan skip_all => 'Skipping as system appears to be a smoker' + if DBICTest::RunMode->is_smoker; +} + +# globalllock so that the test runs alone use DBICTest ':GlobalLock'; +use Benchmark; + # This is a rather unusual test. # It does not test any aspect of DBIx::Class, but instead tests the # perl installation this is being run under to see if it is:- @@ -19,25 +36,18 @@ use DBICTest ':GlobalLock'; # Perl Performance Issues on Red Hat Systems in # L -plan skip_all => - 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set' - if ( $ENV{DBIC_NO_WARN_BAD_PERL} ); - -plan skip_all => 'Skipping as system appears to be a smoker' - if DBICTest::RunMode->is_smoker; - -plan tests => 3; - -ok( 1, 'Dummy - prevents next test timing out' ); - # we do a benchmark test filling an array with blessed/overloaded references, # against an array filled with array refs. # On a sane system the ratio between these operation sets is 1 - 1.5, # whereas a bugged system gives a ratio of around 8 -# we therefore consider there to be a problem if the ratio is >= 2 +# we therefore consider there to be a problem if the ratio is >= $fail_ratio +my $fail_ratio = 3; + +ok( $fail_ratio, "Testing for a blessed overload slowdown >= ${fail_ratio}x" ); + my $results = timethese( - -1, # run for 1 CPU second each + -1, # run for 1 WALL second each { no_bless => sub { my %h; @@ -57,7 +67,7 @@ my $results = timethese( my $ratio = $results->{no_bless}->iters / $results->{bless_overload}->iters; -ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' ) +cmp_ok( $ratio, '<', $fail_ratio, 'Overload/bless performance acceptable' ) || diag( "\n", "This perl has a substantial slow down when handling large numbers\n", @@ -76,7 +86,7 @@ ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' ) SKIP: { skip "Not checking for bless handling as performance is OK", 1 - if ( $ratio < 2 ); + if Test::Builder->new->is_passing; { package # don't want this in PAUSE @@ -93,7 +103,7 @@ SKIP: { } sub _possibly_has_bad_overload_performance { - return $] < 5.008009 && !_has_bug_34925(); + return( "$]" < 5.008009 and !_has_bug_34925() ); } # If this next one fails then you almost certainly have a RH derived @@ -117,3 +127,5 @@ SKIP: { "file " . __FILE__ . "\n", ); } + +done_testing;