Performance should be dependent on infected persons
Motivation / Current Behaviour
Currently it doesnt make a huge difference, if a lot of people are infectious for the runtime. But it should, as we do alot of unneccessary work.
Enhancement description
We need to just do it for a cell/location with a transmission risk. Currently we do this for every location.
Additional context
No response
Checklist
- [X] Attached labels, especially loc:: or model:: labels.
- [X] Linked to project
On paper branch: when caching exposure rate flag location as infecitous. On main: probablysame
first tests on main show a 20% performance gain
As we already return early, if there is no infectious person (random event with sum =0) we are already sipping the computational heavy stuff (RNG)
I also couldn't find an improvement, although i was certain i saw one earlier, but to no avail i didn't find it anymore.
The Benchmark was tested for 20 days, at the end of the 20 days almost everyone was infected(inf_state = 0, sum = 7234 at the end (so at least 85% infected)
Before benchmark:
---------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------
abm_benchmark/abm_benchmark_50k 2137 ms 2134 ms 1
abm_benchmark/abm_benchmark_100k 4424 ms 4419 ms 1
Benchmark with early return for interaction (no interaction at all):
---------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------
abm_benchmark/abm_benchmark_50k 1482 ms 1481 ms 1
abm_benchmark/abm_benchmark_100k 3334 ms 3331 ms 1
Benchmark with no infectious persons and no early return:
---------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------
abm_benchmark/abm_benchmark_50k 1545 ms 1545 ms 1
abm_benchmark/abm_benchmark_100k 3323 ms 3323 ms 1
I tested it again, it dosnt make a difference