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

Change return value of simplification to include removed variants #163

Closed molpopgen closed 5 years ago

molpopgen commented 5 years ago

For time series simulations where one tracks large numbers of ancient samples, simulations with tree sequences slow down the more ancient samples you take. When profiling examples/wfts, we see that the time is spent in fwdpp::ts::count_mutations due to time spent advancing trees in fwdpp::ts::tree_visitor::operator().

It turns out that we can skip mutation counting entirely if its only purpose is to generate a recycling queue. If we modify the return value of simplify to include either a vector of indexes of "simplified-out" variants, or a std::queue of such indexes, then we can skip count_mutations entirely. This will be an especially useful optimization for simulations of phenotypes.