Bugzilla – Attachment 135071 Details for
Bug 30789
Improve performance of AddBiblio when importing records with many items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30789: Improve performance of AddBiblio
Bug-30789-Improve-performance-of-AddBiblio.patch (text/plain), 2.23 KB, created by
Nick Clemens
on 2022-05-17 12:41:25 UTC
(
hide
)
Description:
Bug 30789: Improve performance of AddBiblio
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2022-05-17 12:41:25 UTC
Size:
2.23 KB
patch
obsolete
>From 04282ed97fb148ef1255789fb27aba48ecc58320 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 17 May 2022 12:29:40 +0000 >Subject: [PATCH] Bug 30789: Improve performance of AddBiblio > >AddBiblio calls TransformMarcRecordToKoha. We are only interested in getting >biblio and biblioitems info, so we can pass 'no_items' to save some field lookups > >Additionally we can pass the subfield structure we have already fetched into the subroutine >TransformMarcToKohaOneField > >Testing with NYTProf I saw a reduction of ~6 seconds when importing ~400 bibs and ~1000 items >i.e. I exported and imported the sample data (after removing duplicate 010 from record 72) > >To test: >1 - Stage and import some records >2 - Confirm it works the same before and after patch >--- > C4/Biblio.pm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 459a94510a..25917d488c 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -220,7 +220,7 @@ sub AddBiblio { > > # transform the data into koha-table style data > SetUTF8Flag($record); >- my $olddata = TransformMarcToKoha( $record, $frameworkcode ); >+ my $olddata = TransformMarcToKoha( $record, $frameworkcode, 'no_items' ); > > my $biblio = Koha::Biblio->new( > { >@@ -2326,7 +2326,7 @@ sub TransformMarcToKoha { > foreach my $kohafield ( keys %{ $mss } ) { > my ( $table, $column ) = split /[.]/, $kohafield, 2; > next unless $tables{$table}; >- my $val = TransformMarcToKohaOneField( $kohafield, $record ); >+ my $val = TransformMarcToKohaOneField( $kohafield, $record, $mss->{$kohafield} ); > next if !defined $val; > my $key = _disambiguate( $table, $column ); > $result->{$key} = $val; >@@ -2382,10 +2382,10 @@ sub _disambiguate { > =cut > > sub TransformMarcToKohaOneField { >- my ( $kohafield, $marc ) = @_; >+ my ( $kohafield, $marc, $mss ) = @_; > > my ( @rv, $retval ); >- my @mss = GetMarcSubfieldStructureFromKohaField($kohafield); >+ my @mss = $mss? @{$mss} : GetMarcSubfieldStructureFromKohaField($kohafield); > foreach my $fldhash ( @mss ) { > my $tag = $fldhash->{tagfield}; > my $sub = $fldhash->{tagsubfield}; >-- >2.30.2
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 30789
:
135071
|
135216
|
135238