Bug 8219 - get_biblio_authorised_values embarrassingly inefficient
Summary: get_biblio_authorised_values embarrassingly inefficient
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Galen Charlton
QA Contact:
Depends on: 7923
  Show dependency treegraph
Reported: 2012-06-10 00:39 UTC by Jared Camins-Esakov
Modified: 2020-01-06 20:15 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-06-10 00:39:00 UTC
The routine C4::Biblio::get_biblio_authorised_values is horrifyingly inefficient. In a relatively low-powered system with a large number of authorized values, exclusive time in get_biblio_authorised_values can be several seconds or more when doing a search, since the routine is called once per result.
Comment 1 Katrin Fischer 2019-04-28 14:00:03 UTC
It looks like there is only one occurence of this method in the current codebase, but sadly it's Search.pm:

C4/Search.pm:        $oldbiblio->{'authorised_value_images'}  = ($search_context->{'interface'} eq 'opac' && C4::Context->preference('AuthorisedValueImages')) || ($search_context->{'interface'} eq 'intranet' && C4::Context->preference('StaffAuthorisedValueImages')) ? C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ) : [];
Comment 2 Jonathan Druart 2019-04-29 00:05:00 UTC
Well, not really, the method has been removed by
  commit 85e7d186ec2f0a30e479bc924a1023c73eefc28e
  Bug 16167: Remove Authorised value images prefs

But the call has been re-added recently:
  commit 5e4e10c4ca558180137bf5a4ff5a68495efa0ec7
  Bug 14385: Extend OpacHiddenItems to allow specifying exempt borrower categories

So, this bug is fixed, but we have another one running.