The tree sequence type has efficient access to tree by position or by tree index.
For a given number of available threads, one strategy would be to get site counts
in batches of (number of trees)/(number of threads) trees.
One can also imagine trying to batch the work such that the number of mutations
processed per thread is as even as possible.
More complex strategies may be hard to optimize in practice.
The rayon crate would be a natural choice.
The tree sequence type has efficient access to tree by position or by tree index.
For a given number of available threads, one strategy would be to get site counts
in batches of (number of trees)/(number of threads) trees.
One can also imagine trying to batch the work such that the number of mutations
processed per thread is as even as possible.
More complex strategies may be hard to optimize in practice.
The rayon crate would be a natural choice.