-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PE, RPE and related optimisations #926
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use a global precalc to get all the range inverse scores, set to zero if the branch length is zero. This avoids a lot of operations when summing the local range weights.
remove one variable
Use refaliasing and postfix for loops, and remove a Biodiverse::Utils call.
This takes time to calculate and is generally not needed by most calcs that depend on _calc_pe. Instead we can calculate it within calc_pe_lists, which is the user-facing calc that provides it.
The CANAPE tests were triggering undef warnings.
We have now weaned it.
…with first path Reduces the work done in the xsub.
The Tree class has a method to get a hash of lengths. This is cached so later calls are very cheap. By using this we can avoid many repeated calls to the get_length method. As fast as it is, they can add up across randomisations.
…state var Minor optimisation but avoids sub call costs. The state var should be rarely needed but we might as well not create a new one every time.
We have already calculated the count of labels unique to set 2 so if that is zero then we can return early.
This way we take advantage of any of the calc_abc variants
Avoid the triple negative.
We can calculate the weighted branch lengths from the local ranges and globally weighted branch lengths. This avoids much repeated summation and thus time.
The element count is needed many times so store it in a scalar instead of repeatedly getting it from the array.
The central variant currently needs special handling but this will be removed in a future commit.
Call calc_phylo_rpe2 where possible, otherwise process the branches ourselves. This moves the special case logic out of calc_phylo_rpe2.
The deleted branch was only needed by calc_phylo_rpe_central, and it now contains the same logic.
Avoid list overheads. We only have three options anyway.
These have large time overheads in some cases but are not always needed. For example the user might only need the PE scores.
Most of the time _calc_pe will have been called previously so the cache will exist. However there are occasions where this is not done, for example the range weighted phylo turnover calcs. That calc has also now been simplified.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.