biodiverse
biodiverse copied to clipboard
Indices and randomisations: allow re-use of invariant results between analyses
Profiling indicates some of the bottlenecks are where a global precalc needs to be recalculated for each iteration of a randomisation. One example is the tree with equal length branches.
It should be possible to identify randomisations, or other conditions, where these precalcs are unchanged between iterations and then re-use them in the analysis of the random distribution.
For example, globally precalculated tree subsets will be unchanged where the tree is not shuffled by the randomisation and the same set of labels is generated each iteration. This is the common scenario as trees are not often randomised, and the random basedatas most commonly have the richness and range patterns replicated exactly.
A possible approach is to add optional arguments to global precalcs and save them into a data structure via global postcalcs. This is then returned to the caller for re-use.