https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30169
--- Comment #5 from Martin Renvoize <[email protected]> --- #!/usr/bin/env perl use strict; use warnings; use Benchmark qw/cmpthese timethese/; use Koha::Libraries; use Koha::Database; my $schema = Koha::Database->schema; cmpthese( -100, { kohaPrefetch => sub { for ( my $i = 0 ; $i < 250 ; $i++ ) { my $checkout = Koha::Checkouts->find( { itemnumber => 10 }, { prefetch => [ 'item', 'patron' ] } ); my $item_id = $checkout->item->itemnumber; my $patron_id = $checkout->patron->borrowernumber; } }, kohaJoin => sub { for ( my $i = 0 ; $i < 250 ; $i++ ) { my $checkout = Koha::Checkouts->find( { itemnumber => 10 } ); my $item_id = $checkout->item->itemnumber; my $patron_id = $checkout->patron->borrowernumber; } }, dbicPrefetch => sub { for ( my $i = 0 ; $i < 250 ; $i++ ) { my $checkout = $schema->resultset('Issue')->find( { itemnumber => 10 }, { prefetch => [ 'item', 'patron' ] } ); my $item_id = $checkout->item->itemnumber; my $patron_id = $checkout->patron->borrowernumber; } }, dbicJoin => sub { for ( my $i = 0 ; $i < 250 ; $i++ ) { my $checkout = $schema->resultset('Issue')->find( { itemnumber => 10 } ); my $item_id = $checkout->item->itemnumber; my $patron_id = $checkout->patron->borrowernumber; } } } ); Alternatively, for instantiation speed.. the prefetch creates a bigger, heavier, object and so clearly will be slower than without. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
