SwissTPH / openmalaria

A simulator of malaria epidemiology and control
GNU General Public License v2.0
75 stars 30 forks source link

Performance improvement in DescriptiveInfection::determineDensities() #365

Closed acavelan closed 1 year ago

acavelan commented 1 year ago

DescriptiveInfection::determineDensities() is the slowest part of the code base when using the base model.

This rewrites the computation to keep the densities calculations in log space and remove some very slow calls to exp(), pow() and log().

The performance gain is about 10% on the example scenario and scales with the number of infections. We can expect 20% to 40% in very high transmission settings.

Test outputs are identical.