From: Peter Rabbitson Date: Sat, 20 Mar 2010 08:26:12 +0000 (+0000) Subject: Extend benchmark X-Git-Tag: v0.08121~50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21374921b62da7753280e44cc58857c8fa14cda3;p=dbsrgits%2FDBIx-Class.git Extend benchmark --- diff --git a/maint/benchmark_datafetch.pl b/maint/benchmark_datafetch.pl index 7af9a30..f42d79e 100755 --- a/maint/benchmark_datafetch.pl +++ b/maint/benchmark_datafetch.pl @@ -7,15 +7,19 @@ use FindBin; use lib "$FindBin::Bin/../t/lib"; use lib "$FindBin::Bin/../lib"; use DBICTest; +use DBIx::Class::ResultClass::HashRefInflator; # older dbic didn't load it + +printf "Benchmarking DBIC version %s\n", DBIx::Class->VERSION; my $schema = DBICTest->init_schema(); my $rs = $schema->resultset ('Artist'); -$rs->populate ([ map { { name => "Art_$_"} } (1 .. 3000) ]); +$rs->populate ([ map { { name => "Art_$_"} } (1 .. 10000) ]); use Benchmark qw/cmpthese/; -cmpthese(-1, { +cmpthese(-5, { 'Cursor' => sub { $rs->reset; my @r = $rs->cursor->all }, 'HRI' => sub { $rs->reset; my @r = $rs->search ({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } )->all }, 'RowObj' => sub { $rs->reset; my @r = $rs->all }, + 'DBI' => sub { my @r = $schema->storage->_get_dbh->selectall_arrayref ('SELECT * FROM ' . ${$rs->as_query}->[0] ) }, });