Bug 13214

Summary: Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly
Product: Koha Reporter: Olli-Antti Kivilahti <olli-antti.kivilahti>
Component: AcquisitionsAssignee: Olli-Antti Kivilahti <olli-antti.kivilahti>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, kyle, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 7180    
Bug Blocks:    
Attachments: Bug 13214 - Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly
Bug 13214 - Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly
[PASSED QA] Bug 13214 - Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly

Description Olli-Antti Kivilahti 2014-11-06 14:44:50 UTC
When you have 167 import batches and you try to pick one by going to acqui/addorderiso2709.pl, it takes ~16s to load the page.

This is because all import_records are loaded simply to check if an import_batch has recors with the given status.

This patch fixes this and cuts the load time to 1.6s
Comment 1 Olli-Antti Kivilahti 2014-11-06 14:48:41 UTC Comment hidden (obsolete)
Comment 2 Olli-Antti Kivilahti 2014-11-06 14:49:38 UTC
Tested using Jonathan's excellent tutorial about Perl performace profiling!

http://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf
Comment 3 Jonathan Druart 2014-11-06 16:04:05 UTC
(In reply to Olli-Antti Kivilahti from comment #2)
> Tested using Jonathan's excellent tutorial about Perl performace profiling!
> 
> http://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf

It's not mine :)
Comment 4 Jonathan Druart 2014-11-06 16:08:32 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2014-11-21 16:06:19 UTC
Created attachment 33794 [details] [review]
[PASSED QA] Bug 13214 - Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly

TEST PLAN:

1. Load 167 staged files to Koha.
2. Try to make an acquisiton from a staged file.
3. Wait 16s for the acqui/addorderiso2709.pl -view to load.

AFTER PATCH:

1. Load 167 staged files to Koha.
2. Try to make an acquisiton from a staged file.
3. Wait 1.6s for the acqui/addorderiso2709.pl -view to load.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Tomás Cohen Arazi 2014-12-01 13:02:30 UTC
Patch pushed to master.

Thanks Olli!