Currently the model takes a long time to run. I did some basic profiling and it suggested the I$copy() calls in processes.R were taking ages, especially with the households (which are our most numerous location by a large margin.
Spoke to Giovanni who kindly added in a new bitset operator to individual called bitset_count_and() which basically counts the number of values both set to 1 in two bitsets (i.e. what we currently do with a cumbersome $copy() and $and() (which necessitates allocating memory to the heap and takes time). You can see more here: https://github.com/mrc-ide/individual/commit/bcd6d13b6b682f719cd8ddf6bc27e38b45d109e1
I've done some basic benchmarking and for a population of 100,000 I think we get about a 60% speedup. The PR's not quite done (I need to delete some of the code I only commented out before), but this seems promising!
Currently the model takes a long time to run. I did some basic profiling and it suggested the
I$copy()
calls inprocesses.R
were taking ages, especially with the households (which are our most numerous location by a large margin.Spoke to Giovanni who kindly added in a new bitset operator to
individual
calledbitset_count_and()
which basically counts the number of values both set to 1 in two bitsets (i.e. what we currently do with a cumbersome$copy()
and$and()
(which necessitates allocating memory to the heap and takes time). You can see more here: https://github.com/mrc-ide/individual/commit/bcd6d13b6b682f719cd8ddf6bc27e38b45d109e1I've done some basic benchmarking and for a population of 100,000 I think we get about a 60% speedup. The PR's not quite done (I need to delete some of the code I only commented out before), but this seems promising!
Also fixes this known issue with newest version of
individual
: https://github.com/mrc-ide/individual/pull/203Can test with the following code: