Skip to content

Commit

Permalink
perf: parallelize checksum generation for contig
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 16, 2023
1 parent e284667 commit bd02ffc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions fasta_checksum_utils/_contig.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import pysam
from typing import Generator
from .algorithms import ChecksumAlgorithm
Expand All @@ -23,8 +24,4 @@ def gen_sequence() -> Generator[bytes, None, None]:
.encode("ascii")
)

r = []
for a in algorithms:
r.append(await a.checksum_sequence(gen_sequence()))

return tuple(r)
return tuple(await asyncio.gather(*(a.checksum_sequence(gen_sequence()) for a in algorithms)))

0 comments on commit bd02ffc

Please sign in to comment.