Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: RFC: Is the Bible encoded in DNA?

by wstryder (Novice)
on May 14, 2018 at 19:01 UTC ( #1214491=note: print w/replies, xml ) Need Help??


in reply to Re^2: RFC: Is the Bible encoded in DNA?
in thread RFC: Is the Bible encoded in DNA?

Nobody has spotted the obvious, that the code for reading the file is painfully slow.

A significant improvement would be:

while (read($fh, my $char, 1) && $eof) { if ($char =~ m/[ACGT]/ ) { $i++; if ($i >= $start_genome && $i < $end_genome) { push (@genome, $char); } elsif ($i > $end_genome) { $eof = 0; # do the searching here, instead of outside the loop! } } }

Replies are listed 'Best First'.
Re^4: RFC: Is the Bible encoded in DNA?
by wstryder (Novice) on May 14, 2018 at 20:56 UTC
    That's now fixed and the algorithm doesn't go back to the beginning of the file every time a chunk is read. Silly me.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2019-10-20 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?