https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30860
--- Comment #30 from Nick Clemens <[email protected]> --- (In reply to Jonathan Druart from comment #29) > Created attachment 148562 [details] [review] > Bug 30860: [alternative patch] Cache CanItemBeReserved return value > > Instead of hacking CanBookBeReserved this patch suggests to simply cache > the return value of CanItemBeReserved that could be then returned *on > demand* > We don't want to introduce side-effects hard to catch from this simple > change, so let's return the cache value only from the 2 scripts we are > dealing with. This works, and in initial testing seems to offer improvement. I have one hesitation Current: code calls CanBookBeReserved, which exits on first holdable item, then we call CanItemBeReserved for every item Worst case, last item is holdable - for 100 items we call CanItemBeReserved 200 times My patches: code calls CanBookBeReserved which in turn calls CanItemBeReserved for every item. Then we loop over the results for each item Worst case, we call CanItemBeReserved 100 times - we do this no matter what Alternate patches: code calls CanBookBeReserved which exits on first holdable item we then retrieve any alreayd calculated from cache, then we cache each result as we go forward. Worst case - first item is holdable - we retrieve a single value from cache, then cache every subsequent CanItemBeReserved call and never use it - though we still only call CanItemBeReserved 100 times max I don't know what the actual tendency for number of items holdable, but it feels like we can do a lot of caching that we don't necessarily need. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
