Skip to content

Commit

Permalink
Clean up benchmarks ns code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Darrick Wiebe committed Mar 29, 2015
1 parent 9a13ae9 commit f43867b
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions dev/benchmarks.clj
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
(ns benchmarks
(:use jordanlewis.data.union-find)
(:use jordanlewis.data.union-find
dev-utils)
(:require [criterium.core :refer [bench quick-bench]]))

(defn make-stars [stars points]
(for [a (range stars)
b (range points)
:let [b (+ stars (* a points) b)]]
[a b (str b)]))

(defn partition-graph [uf stars points -conj -union]
(reduce
(fn [uf [a b c]]
(-> uf
(-conj a)
(-conj b)
(-conj c)
(-union a b)
(-union b c)))
uf
(make-stars stars points)))

(comment

(quick-bench (partition-graph (union-find) 10 100 conj union))
Expand Down

0 comments on commit f43867b

Please sign in to comment.