Skip to content

Commit

Permalink
Indices: optimise _calc_phylo_abc_lists
Browse files Browse the repository at this point in the history
If we have no second neighbour set then
there is no need to run all the hash processing.
  • Loading branch information
shawnlaffan committed Feb 25, 2024
1 parent b7456f0 commit b321c48
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Biodiverse/Indices/Phylogenetic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,15 @@ sub _calc_phylo_abc_lists {
el_list => $args{element_list1},
);

if (!@{$args{element_list2}}) {
my $res = {
PHYLO_A_LIST => {},
PHYLO_B_LIST => $nodes_in_path1,
PHYLO_C_LIST => {},
};
return wantarray ? %$res : $res;
}

my $nodes_in_path2 = @{$args{element_list2}}
? $self->get_path_lengths_to_root_node (
%args,
Expand Down

0 comments on commit b321c48

Please sign in to comment.