From: Peter Rabbitson Date: Tue, 9 Apr 2013 07:45:25 +0000 (+0200) Subject: Tweak timing of t/zzzzzzz_perl_perf_bug.t - we started getting false positives X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db2e53927f8913cdb8f3c2ec42820d99f53b1eb3;p=dbsrgits%2FDBIx-Class-Historic.git Tweak timing of t/zzzzzzz_perl_perf_bug.t - we started getting false positives http://www.cpantesters.org/cpan/report/356dd340-9de0-11e2-9265-e31b922ed931 http://www.cpantesters.org/cpan/report/2e2063f1-6bf4-1014-817e-b9974151da38 Not considering dropping the test because... well it is a good test ;) --- diff --git a/t/zzzzzzz_perl_perf_bug.t b/t/zzzzzzz_perl_perf_bug.t index f67c854..c1e0ab8 100644 --- a/t/zzzzzzz_perl_perf_bug.t +++ b/t/zzzzzzz_perl_perf_bug.t @@ -13,9 +13,11 @@ BEGIN { if DBICTest::RunMode->is_smoker; } -use Benchmark; +# 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:- @@ -30,18 +32,18 @@ use DBICTest ':GlobalLock'; # Perl Performance Issues on Red Hat Systems in # L -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; @@ -61,7 +63,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", @@ -80,7 +82,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 @@ -121,3 +123,5 @@ SKIP: { "file " . __FILE__ . "\n", ); } + +done_testing;