Skip to content

Commit d839ac1

Browse files
author
David Nolen
committed
add simple transducers benchmark
1 parent 9446e27 commit d839ac1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

benchmark/cljs/benchmark_runner.cljs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,17 @@
312312
(println ";; reducers")
313313
(simple-benchmark [xs (into [] (range 1000000))] (r/reduce + (r/map inc (r/map inc (r/map inc xs)))) 1)
314314

315+
(dotimes [_ 10]
316+
(let [xs (into [] (range 1000000))]
317+
(time (r/reduce + (r/map inc (r/map inc (r/map inc xs)))))))
318+
319+
(println ";; transducers")
320+
(simple-benchmark [xs (into [] (range 1000000))] (transduce (comp (map inc) (map inc) (map inc)) + 0 xs) 1)
321+
322+
(dotimes [_ 10]
323+
(let [xs (into [] (range 1000000))]
324+
(time (transduce (comp (map inc) (map inc) (map inc)) + 0 xs))))
325+
315326
(println "\n")
316327

317328
(println ";; multimethods")

0 commit comments

Comments
 (0)