Skip to content

Commit

Permalink
Micro-optimise Dendrogram::set_cluster
Browse files Browse the repository at this point in the history
Avoiding some looping and method calls
will help with larger trees.
  • Loading branch information
shawnlaffan committed Jan 9, 2024
1 parent dbdd075 commit e658412
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/Biodiverse/GUI/Dendrogram.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2211,11 +2211,10 @@ sub set_cluster {

# Clear any palette colours
delete $self->{node_colours_cache};
$self->{node_palette_colours} = {};
foreach my $node_ref (values %{$cluster->get_node_hash}) {
#$node_ref->set_cached_value(__gui_palette_colour => undef);
$self->{node_palette_colours}{$node_ref->get_name} = undef;
}
my $node_hash = $cluster->get_node_hash;
my %node_colour_hash;
@node_colour_hash{keys %$node_hash} = ();
$self->{node_palette_colours} = \%node_colour_hash;

# skip incomplete clusterings (where the tree was not built)
my $completed = $cluster->get_param('COMPLETED') // 1;
Expand Down

0 comments on commit e658412

Please sign in to comment.