[Koha-bugs] [Bug 28371] Improve performance of XSLTParse4Display

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 21 03:40:53 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28371

--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
Comment on attachment 121111
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=121111
Bug 28371: WIP

Review of attachment 121111:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=28371&attachment=121111)
-----------------------------------------------------------------

::: C4/XSLT.pm
@@ +40,4 @@
>  
>  my $engine; #XSLT Handler object
>  my %authval_per_framework;
> +my %authval_descs;

Are you sure about this scope? 

This will be for the life of the Starman worker, which could lead to stale data
and inconsistent results, if you're actively changing authorised value
descriptions.

Having a cache scoped to the request would be safer I think. I suppose a
"$cache" hashref passed to XSLTParse4Display and then on to
transformMARCXML4XSLT would do the trick.

@@ +91,5 @@
> +                        } else {
> +                            if( $av->{$tag}->{$letter} ){
> +                                my $orig_val = $value;
> +                                $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib );
> +                                $authval_descs{$frameworkcode.$tag.$letter.$orig_val} = $value;

Sometimes, I wonder if we should just fetch all the authorised value
descriptions at the start. The pro is that you have a max of 1 database lookup.
The con is that you might be fetching a lot more data than you would if you
just end up needing 1 description. However, I haven't done any benchmarking on
the time of those pros and cons...

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list