6 use Benchmark qw/cmpthese/;
8 use lib "$FindBin::Bin/../t/lib";
9 use lib "$FindBin::Bin/../lib";
11 use DBIx::Class::ResultClass::HashRefInflator; # older dbic didn't load it
13 printf "Benchmarking DBIC version %s\n", DBIx::Class->VERSION;
15 my $schema = DBICTest::Schema->connect ('dbi:SQLite::memory:');
18 my $rs = $schema->resultset ('Artist');
19 $rs->populate ([ map { { name => "Art_$_"} } (1 .. 10000) ]);
21 my $dbh = $schema->storage->dbh;
22 my $sql = sprintf ('SELECT %s FROM %s %s',
23 join (',', @{$rs->_resolved_attrs->{select}} ),
24 $rs->result_source->name,
25 $rs->_resolved_attrs->{alias},
29 my @r = $schema->storage->dbh->selectall_arrayref ('SELECT * FROM ' . ${$rs->as_query}->[0] )
30 } if $rs->can ('as_query');
33 Cursor => sub { $rs->reset; my @r = $rs->cursor->all },
34 HRI => sub { $rs->reset; my @r = $rs->search ({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } )->all },
35 RowObj => sub { $rs->reset; my @r = $rs->all },
36 RawDBI => sub { my @r = $dbh->selectall_arrayref ($sql) },
37 $compdbi ? (CompDBI => $compdbi) : (),