Bug 16168: Eliminate unneeded C4::Context->dbh calls in C4/Biblio.pm
authorJacek Ablewicz <abl@biblos.pk.edu.pl>
Wed, 30 Mar 2016 10:21:03 +0000 (12:21 +0200)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Thu, 7 Apr 2016 00:03:51 +0000 (00:03 +0000)
commiteb04d174d91201b05b6e348dc672f9351dc0aaf0
tree836d63478767da2a869ac2bb2a48c615b1dab405
parentdde885675418644a201d00c044233a6387d46c72
Bug 16168: Eliminate unneeded C4::Context->dbh calls in C4/Biblio.pm

Right now, ->dbh calls are actually quite expensive (they involve
DB connection health checks, each and every time). Some speed-sensitive
subroutines inside C4/Biblio.pm (GetMarcStructure, GetAuthorisedValueDesc)
have this statement

    my $dbh = C4::Context->dbh;

on top of the code, but they don't always/don't usually need DB
handle - not at that stage at least. This trivial patch eliminates
unneeded ->dbh calls in those subroutines. With it, average
GetMarcStructure() running time goes down from 14 miliseconds
to 9 miliseconds (on top of Bug 16166), it also makes catalogue
search profiling a bit easier.

Test plan:

1) apply patch
2) ensure that catalogue searches are still working
3) run t/*Biblio* tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
C4/Biblio.pm