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)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 15 Mar 2024 14:39:11 +0000 (15:39 +0100)
commit202628342ab9397e8b15aa5e62c0aaa041d3c8a0
treea692400785483ca9caf4948c039f177aa17c9ff3
parent14388b6478858e298a9f0de104d5e839bc8cb430
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>
Koha/REST/V1/TransferLimits.pm