Skip to content

Commit

Permalink
Squeeze a (very) small amount of improved performance into the range …
Browse files Browse the repository at this point in the history
…calculations

Use an array args variant of a sub

Updates #681
  • Loading branch information
shawnlaffan committed Nov 26, 2017
1 parent 1242dfa commit 1e09017
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/Biodiverse/BaseData.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3689,14 +3689,11 @@ sub get_range_union {
my %shared_elements;
LABEL:
foreach my $label (@$labels) {

#next if not $self->exists_label (label => $label); # skip if it does not exist - get_groups_with_label_as_hash has same effect
my $elements_now =
$self->get_groups_with_label_as_hash( label => $label );
next LABEL
if !scalar
keys %$elements_now; # empty hash - must be no groups with this label
# add these elements as a hash slice
$self->get_groups_with_label_as_hash_aa ( $label );
# if empty hash then must be no groups with this label
next LABEL if !scalar keys %$elements_now;
# add these elements as a hash slice
@shared_elements{ keys %$elements_now } = undef;
}

Expand Down

0 comments on commit 1e09017

Please sign in to comment.