Permalink
Browse files

Back out constructor/prefetch rewrite introduced mainly by 43245ad

It was shipped against the authors advice, while containing multiple known
bugs. After the expected bugreports went warnocked for over two weeks by the
new DBIC release team, it seems that the only way to partially restore the
release quality DBIC users have come to expect, is to currently throw this
code away until better times.

Should resolve RT#78456 and the issues reported in these threads:
http://lists.scsys.co.uk/pipermail/dbix-class/2012-July/010681.html
http://lists.scsys.co.uk/pipermail/dbix-class/2012-July/010682.html
  • Loading branch information...
1 parent 571df67 commit c97338007ede15e7c62095a642b3de382a3508bd @ribasushi ribasushi committed with frioux Jul 24, 2012
@@ -16,13 +16,7 @@
$schema->deploy;
my $rs = $schema->resultset ('Artist');
-
-my $hri_rs = $rs->search ({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } );
-
-#DB::enable_profile();
-#my @foo = $hri_rs->all;
-#DB::disable_profile();
-#exit;
+$rs->populate ([ map { { name => "Art_$_"} } (1 .. 10000) ]);
my $dbh = $schema->storage->dbh;
my $sql = sprintf ('SELECT %s FROM %s %s',
@@ -31,19 +25,14 @@
$rs->_resolved_attrs->{alias},
);
-for (1,10,20,50,200,2500,10000) {
- $rs->delete;
- $rs->populate ([ map { { name => "Art_$_"} } (1 .. $_) ]);
- print "\nRetrieval of $_ rows\n";
- bench();
-}
-
-sub bench {
- cmpthese(-3, {
- Cursor => sub { my @r = $rs->cursor->all },
- HRI => sub { my @r = $hri_rs->all },
- RowObj => sub { my @r = $rs->all },
- DBI_AoH => sub { my @r = @{ $dbh->selectall_arrayref ($sql, { Slice => {} }) } },
- DBI_AoA=> sub { my @r = @{ $dbh->selectall_arrayref ($sql) } },
- });
-}
+my $compdbi = sub {
+ my @r = $schema->storage->dbh->selectall_arrayref ('SELECT * FROM ' . ${$rs->as_query}->[0] )
+} if $rs->can ('as_query');
+
+cmpthese(-3, {
+ 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 },
+ RawDBI => sub { my @r = $dbh->selectall_arrayref ($sql) },
+ $compdbi ? (CompDBI => $compdbi) : (),
+});
Oops, something went wrong.

0 comments on commit c973380

Please sign in to comment.