biodiverse icon indicating copy to clipboard operation
biodiverse copied to clipboard

Indices and randomisations: allow re-use of invariant results between analyses

Open shawnlaffan opened this issue 1 year ago • 1 comments

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.

shawnlaffan avatar Oct 28 '22 02:10 shawnlaffan

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.

shawnlaffan avatar Oct 28 '22 02:10 shawnlaffan