Skip to content

Instantly share code, notes, and snippets.

@TransGirlCodes
Created March 25, 2017 14:01
Show Gist options
  • Save TransGirlCodes/b2e4713c07d254ed899088c0f22e85ca to your computer and use it in GitHub Desktop.
Save TransGirlCodes/b2e4713c07d254ed899088c0f22e85ca to your computer and use it in GitHub Desktop.
Compare old Automa parsers with Deferred parsing Automa parsers.
function scan(T, filename)
reader = open(T, filename)
record = eltype(reader)()
n = 0
try
while true
read!(reader, record)
n += 1
end
catch ex
if !isa(ex, EOFError)
rethrow()
end
end
return n
end
function collect(T, filename)
return length(open(Base.collect, T, filename))
end
println("-- FASTAReader --")
scan(FASTAReader, "ccds.fasta")
@time scan(FASTAReader, "refseqgene.all.genomic.fna")
@time scan(FASTAReader, "ecoli_allreads.fasta")
@time scan(FASTAReader, "/Users/kenta/bioinfo/data/genome/hg38.fa")
println("-- FASTA.Reader --")
scan(FASTA.Reader, "ccds.fasta")
@time scan(FASTA.Reader, "refseqgene.all.genomic.fna")
@time scan(FASTA.Reader, "ecoli_allreads.fasta")
@time scan(FASTA.Reader, "/Users/kenta/bioinfo/data/genome/hg38.fa")
println("-- FASTAReader --")
collect(FASTAReader, "ccds.fasta")
@time collect(FASTAReader, "refseqgene.all.genomic.fna")
@time collect(FASTAReader, "ecoli_allreads.fasta")
@time collect(FASTAReader, "/Users/kenta/bioinfo/data/genome/hg38.fa")
println("-- FASTA.Reader --")
collect(FASTA.Reader, "ccds.fasta")
@time collect(FASTA.Reader, "refseqgene.all.genomic.fna")
@time collect(FASTA.Reader, "ecoli_allreads.fasta")
@time collect(FASTA.Reader, "/Users/kenta/bioinfo/data/genome/hg38.fa")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment