I wrote bioinformatics software a long time ago. Meaning that I remember reading the bioperl code back to read FASTA files around Y2K.<p>Their technique is still in use, at <a href="https://github.com/bioperl/bioperl-live/blob/master/lib/Bio/SeqIO/fasta.pm" rel="nofollow">https://github.com/bioperl/bioperl-live/blob/master/lib/Bio/...</a> . The key point is they set the input record separator, like this:<p><pre><code> local $/ = "\n>";
</code></pre>
This gets Perl to read each FASTA record as a single block, which they then post-process into title and sequence.<p>Raku has a per-filehandle version, according to <a href="https://docs.raku.org/language/5to6-perlvar" rel="nofollow">https://docs.raku.org/language/5to6-perlvar</a><p>In principle, since it does more work closer to the machine, it should be faster. I haven't tested it.