For a biblio with a large number of holdings (which could be the case for serials for example) Item::is_bundle is one of the main culprits in terms of performance. I know it's usually frowned upon substituting DBIx queries with the DBI-equivalent, but think there are few other option in this case and should be very unlikely to cause any future regressions. Attached before and after flamegraphs to illustrate the difference in performance.
Created attachment 164023 [details] Before
Created attachment 164024 [details] After
Created attachment 164025 [details] [review] Bug 36441: Improve performance of Item::is_bundle Perform count using DBI-query in Item::is_bundle to significantly improve performance. To test: 1) Go to the details page of a bibio with a large number of holdings holdings, preferably more than a hundred, and take note of page load time. 3) Apply patch 4) Reload the page and take note of page load time. 5) There should be an improvement of about 10-15% 6) Ensure tests in t/db_dependent/Koha/Item.t pass Sponsored-by: Gothenburg University Library
Created attachment 164026 [details] [review] Bug 36441: Improve performance of Item::is_bundle Perform count using DBI-query in Item::is_bundle to significantly improve performance. To test: 1) Go to the details page of a bibio with a large number of holdings holdings, preferably more than a hundred, and take note of page load time. 3) Apply patch 4) Reload the page and take note of page load time. 5) There should be an improvement of about 10-15% 6) Ensure tests in t/db_dependent/Koha/Item.t pass Sponsored-by: Gothenburg University Library
Created attachment 164027 [details] [review] Bug 36441: Add comment explaining why replacing the DBIx call
The patch still applies. Is this affected by or still relevant after Bug 33568 - Use the REST API to display items on the staff biblio detail view added to Koha 24.05? (I'm not a developer...)
I've tested with 175 items on a biblio and it's not enough to see a difference in the load time before and after the patch (the load time varies too much). We need to try with more items.
To test : you can go to any biblio - new item - add multiple items, to create hundreds of them. Then on the biblio page you have to select "All" items so it (otherwise only 20 items will load) For 600 items, the network response times on 4 tests before applying : - 24434 ms - 23750 - 24062 - 24239 after applying : - 23233 ms - 23401 - 23593 - 23883 Can somebody see a difference in speed? As of now the test plan doesn't allow to find a difference, or there's isn't a real difference.