Skip to content

Commit

Permalink
Setup benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
totakke committed Sep 8, 2017
1 parent b143168 commit 4f9c43a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
33 changes: 33 additions & 0 deletions bench/cljam/algo/bam_indexer_bench.clj
@@ -0,0 +1,33 @@
(ns cljam.algo.bam-indexer-bench
(:require [libra.bench :refer :all]
[libra.criterium :as c]
[cljam.test-common :as tcommon]
[cljam.algo.bam-indexer :as bai]))

(defbench create-index-medium-bench
(tcommon/with-before-after {:before (tcommon/prepare-cache!)
:after (tcommon/clean-cache!)}
(are [n] (c/quick-bench (bai/create-index tcommon/medium-bam-file
(str tcommon/temp-dir "/out-" n ".bai")
:n-threads n))
1
2
4)))

;; BAM-indexing benchmark equivalent to being used in the SCfBM paper,
;; https://doi.org/10.1186/s13029-016-0058-6.
;; Note that it requires stupendous time and CPU resources.
(when-let [bam (System/getenv "SCFBM_BENCH_BAM")]
(tcommon/with-before-after {:before (tcommon/prepare-cache!)
:after (tcommon/clean-cache!)}
(defbench create-index-scfbm-bench
(are [n] (dur 10 (bai/create-index bam
(str tcommon/temp-dir "/out-" n ".bai")
:n-threads n))
1
2
3
4
6
8
12))))
28 changes: 28 additions & 0 deletions bench/cljam/algo/depth_bench.clj
@@ -0,0 +1,28 @@
(ns cljam.algo.depth-bench
(:require [libra.bench :refer :all]
[libra.criterium :as c]
[cljam.test-common :as tcommon]
[cljam.algo.depth :as depth]
[cljam.io.sam :as sam]))

(defbench depth-medium-bench
(are [n] (c/quick-bench (with-open [rdr (sam/reader tcommon/medium-bam-file)]
(depth/depth rdr {:chr "chr1" :start 1000000 :end 9999999} {:n-threads n})))
1
2
4))

;; Simple pileup benchmark equivalent to being used in the SCfBM paper,
;; https://doi.org/10.1186/s13029-016-0058-6.
;; Note that it requires stupendous time and CPU/RAM resources.
(when-let [bam (System/getenv "SCFBM_BENCH_BAM")]
(defbench lazy-depth-scfbm-bench
(are [n] (dur 10 (with-open [rdr (sam/reader bam)]
(dorun (depth/lazy-depth rdr {:chr "1"} {:n-threads n}))))
1
2
3
4
6
8
12)))
9 changes: 6 additions & 3 deletions project.clj
Expand Up @@ -13,11 +13,14 @@
[camel-snake-kebab "0.4.0"]
[proton "0.1.2"]]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.8.0"]
[cavia "0.4.1"]]
:plugins [[lein-binplus "0.6.2"]
[cavia "0.4.1"]
[criterium "0.4.4"]
[net.totakke/libra "0.1.0"]]
:plugins [[lein-binplus "0.6.2" :exclusions [org.clojure/clojure]]
[lein-codox "0.10.3"]
[lein-marginalia "0.9.0" :exclusions [org.clojure/clojure]]
[lein-cloverage "1.0.9" :exclusions [org.clojure/clojure]]]
[lein-cloverage "1.0.9" :exclusions [org.clojure/clojure]]
[net.totakke/lein-libra "0.1.0"]]
:test-selectors {:default #(not-any? % [:slow :remote])
:slow :slow ; Slow tests with local resources
:remote :remote ; Tests with remote resources
Expand Down

0 comments on commit 4f9c43a

Please sign in to comment.