Bug 36277: Improve algorithmic complexity of batch_add
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 14 Mar 2024 13:39:56 +0000 (14:39 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 18 Mar 2024 09:24:37 +0000 (10:24 +0100)
commit372adf555d579c290355ff33f891cd205dc0bfac
treed60e5ba237d2f775db6dc7d3cdf9e24c9d9a65c6
parent4c56374272bb458ee0497f9efd42c3db54723fcf
Bug 36277: Improve algorithmic complexity of batch_add

The 2 nested loops are terrible in term of algorithmic complexity.
Especially if we are fetching from there.

The goal of this patch is to fetch all the limits outside of the loop.

If you have 100 libraries, it will remove 100^2 - 1 fetches!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 202628342ab9397e8b15aa5e62c0aaa041d3c8a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/REST/V1/TransferLimits.pm