Skip to content

Commit

Permalink
CLJS-357: large PersistentVector benchmarks
Browse files Browse the repository at this point in the history
Benchmarks for the following:

* building a large vector without using transients (to get an idea of
  conj perf),

* conjing onto a large vector in a situation where this involves a
  push-tail operation,

* associng in non-tail position in a large vector,

* popping a large vector where this involves a pop-tail op.
  • Loading branch information
michalmarczyk authored and David Nolen committed Aug 30, 2012
1 parent bf0622a commit 52820a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions benchmark/cljs/benchmark_runner.cljs
Expand Up @@ -52,6 +52,13 @@
(simple-benchmark [coll (seq [1 2 3])] (next coll) 1000000)
(println)

(println ";;; large vector ops")
(simple-benchmark [] (reduce conj [] (range 40000)) 100)
(simple-benchmark [coll (reduce conj [] (range (+ 32768 32)))] (conj coll :foo) 1000000)
(simple-benchmark [coll (reduce conj [] (range 40000))] (assoc coll 123 :foo) 1000000)
(simple-benchmark [coll (reduce conj [] (range (+ 32768 33)))] (pop coll) 1000000)
(println)

(println ";;; transients")
(print "transient vector, conj! 1000000 items")
(time
Expand Down

0 comments on commit 52820a1

Please sign in to comment.