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.
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.