[Koha-bugs] [Bug 32060] Improve performance of Koha::Item->columns_to_str
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu May 11 17:08:23 CEST 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32060
--- Comment #9 from David Gustafsson <glasklas at gmail.com> ---
(In reply to Jonathan Druart from comment #8)
> 1. Then I would C4::Biblio::GetFrameworkCode and cache there.
>
> 2. - my $tagslib = C4::Biblio::GetMarcStructure(1, $frameworkcode);
> + my $tagslib = C4::Biblio::GetMarcStructure( 1, $frameworkcode, { unsafe
> => 1 } );
>
> Yes, definitely.
>
> 3. - my $value = $self->$column;
> + my $value = $self->_result()->get_column($column);
>
> Really faster?
1. Could do that, but that change is a little bit scarier as we don't expire
the cache and GetFrameworkCode is used extensively in other places. But could
be done in ModBiblio, which is simple enough I guess. Would also speed up other
calls to GetFrameworkCode, doubt would have much impact as it's already pretty
fast and columns_to_str most likely the only place it makes much of a
difference, but you never know.
3. I'm quite surprised myself, but using $self->$column is about 1.4x slower
for a biblio with 1400 items. My guess the offending line of code is:
if ( grep { $_ eq $method } @columns ) {
in AUTOLOAD. Looping over @columns has O(n) time complexity but using a
columns_info hash where columns can be looked in O(1) time. Could be wworth
looking into in another bug to generally speed up accessing of properties in
Koha.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list