Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Jan 31, 2013
1 parent 1a4dad9 commit 59f9889
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/perl5/Bio/JBrowse/HashStore.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ sub sort_stream {
# 1-element cache for crc32 computations
my $hash_cache = $self->{tiny_hash_cache} ||= { key => '' };
return sub {
my $d = $sorted_stream->();
return unless $d;
my $d = $sorted_stream->()
or return;

my $key = $d->[0];
my $hash = $hash_cache->{key} eq $key
? $hash_cache->{hash}
Expand All @@ -167,7 +168,7 @@ sub sort_stream {
$hash_cache->{hash} = $self->_hexHash( $key );
};

return $d && Bio::JBrowse::HashStore::Entry->new(
return Bio::JBrowse::HashStore::Entry->new(
store => $self,
key => $key,
data => $d,
Expand Down

0 comments on commit 59f9889

Please sign in to comment.