Something is wrong with HRI inflation - too slow
Peter Rabbitson [Sat, 20 Mar 2010 08:00:00 +0000 (08:00 +0000)]
maint/benchmark_datafetch.pl [new file with mode: 0755]

diff --git a/maint/benchmark_datafetch.pl b/maint/benchmark_datafetch.pl
new file mode 100755 (executable)
index 0000000..7af9a30
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../t/lib";
+use lib "$FindBin::Bin/../lib";
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+my $rs = $schema->resultset ('Artist');
+$rs->populate ([ map { { name => "Art_$_"} } (1 .. 3000) ]);
+
+use Benchmark qw/cmpthese/;
+
+cmpthese(-1, {
+  '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 },
+});