Bugzilla – Attachment 150866 Details for
Bug 32060
Improve performance of Koha::Item->columns_to_str
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32060: Improve performance of columns_to_str
Bug-32060-Improve-performance-of-columnstostr.patch (text/plain), 2.06 KB, created by
David Gustafsson
on 2023-05-09 13:40:02 UTC
(
hide
)
Description:
Bug 32060: Improve performance of columns_to_str
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2023-05-09 13:40:02 UTC
Size:
2.06 KB
patch
obsolete
>From 6e381f73f41da9f9229f5553ad7f003f188ccb18 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 1 Nov 2022 15:30:01 +0100 >Subject: [PATCH] Bug 32060: Improve performance of columns_to_str > >To test: >1) Ensure tests in t/db_dependent/Koha/Item.t all pass >2) Go to a biblio (preferably as serial) with many items and > click "New" -> "New item" and take not of the response time. >3) Apply the patch. >4) Ensure tests in t/db_dependent/Koha/Item.t still pass >5) Repeat step 1), the response time should be substantially > improved. > >Sponsored-by: Gothenburg University Library >--- > Koha/Item.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 7251a8a094f..0d64aa47542 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1051,9 +1051,15 @@ This is meant to be used for display purpose only. > > sub columns_to_str { > my ( $self ) = @_; >+ my $cache = Koha::Cache::Memory::Lite->get_instance(); >+ my $cache_key = 'Item_columns_to_str_biblio_frameworkcode:' . $self->biblionumber; > >- my $frameworkcode = $self->biblio->frameworkcode; >- my $tagslib = C4::Biblio::GetMarcStructure(1, $frameworkcode); >+ my $frameworkcode = $cache->get_from_cache($cache_key); >+ unless ( defined $frameworkcode ) { >+ $frameworkcode = $self->biblio->frameworkcode; >+ $cache->set_in_cache($cache_key, $frameworkcode); >+ } >+ my $tagslib = C4::Biblio::GetMarcStructure( 1, $frameworkcode, { unsafe => 1 } ); > my ( $itemtagfield, $itemtagsubfield) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); > > my $columns_info = $self->_result->result_source->columns_info; >@@ -1064,7 +1070,7 @@ sub columns_to_str { > > next if $column eq 'more_subfields_xml'; > >- my $value = $self->$column; >+ my $value = $self->_result()->get_column($column); > # Maybe we need to deal with datetime columns here, but so far we have damaged_on, itemlost_on and withdrawn_on, and they are not linked with kohafield > > if ( not defined $value or $value eq "" ) { >-- >2.40.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32060
:
142894
|
144348
|
150866
|
151131
|
151132
|
151133
|
151291
|
151292
|
151464
|
151465