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)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 19 Mar 2024 21:50:12 +0000 (21:50 +0000)
commit667e67555058c20bc50ec9d31f895b920dde2c1f
tree0ccb6be40b09d3afa4085c5add7bd8f014730c15
parent8e7d786871a9969a8b00a66143ac68462fa06630
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>
(cherry picked from commit 372adf555d579c290355ff33f891cd205dc0bfac)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/REST/V1/TransferLimits.pm