molpopgen / fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations
http://fwdpp.readthedocs.io
GNU General Public License v3.0
27 stars 11 forks source link

Improve performance of leaf count updating #231

Closed molpopgen closed 4 years ago

molpopgen commented 4 years ago

Some profiling during work on molpopgen/fwdpy11#289 shows that the functions in fwdpp/ts/detail/advance_marginal_tree_policies.hpp for updating leaf counts work really really hard when the number of preserved samples is huge.

It turns out that vector access is up to 50% of the run time in fwdpy11 for such cases, and it can be reduced by simply checking if the leaf counts to update are non-zero.

molpopgen commented 4 years ago

At best, this check can only be applied to updating the outdoing leaf counts, as they cannot decrement to < 0?