Skip to content

Commit

Permalink
Reduce allocation overhead in benchmark code
Browse files Browse the repository at this point in the history
  • Loading branch information
athos committed Dec 4, 2023
1 parent fa62c3e commit 2a17a4e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bench/cljam/io/sam_bench.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
(are [f decode-opts?]
(c/quick-bench
(with-open [r (sam/reader f)]
(doseq [a (sam/read-alignments r)
opts (when decode-opts? (:options a))]
opts)))
(run! (fn [aln]
(when decode-opts?
(dorun (:options aln))))
(sam/read-alignments r))))
tcommon/test-bam-file false
tcommon/test-bam-file true
tcommon/medium-bam-file false
Expand All @@ -53,7 +54,8 @@
(are [f]
(c/quick-bench
(with-open [r (sam/reader f)]
(doseq [a (vec (take 10000000 (sam/read-alignments r)))
opts (:options a)]
opts)))
(transduce (take 10000000)
(completing #(dorun (:options %2)))
nil
(sam/read-alignments r))))
tcommon/large-bam-file))

0 comments on commit 2a17a4e

Please sign in to comment.