Created
March 2, 2013 08:51
-
-
Save Johniel/5070202 to your computer and use it in GitHub Desktop.
reducersをブン回す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (clojure-version) | |
"1.4.0" | |
user=> (require '[clojure.math.numeric-tower :as math]) | |
nil | |
user=> (for [n (range 0 26)] | |
#_=> (let [v (vec (range 0 (math/expt 2 n)))] | |
#_=> (do (System/gc) | |
#_=> (time (reduce + (filter even? (map #(mod % 2) v))))))) | |
("Elapsed time: 0.272565 msecs" | |
"Elapsed time: 0.084423 msecs" | |
"Elapsed time: 0.220568 msecs" | |
"Elapsed time: 0.068781 msecs" | |
"Elapsed time: 0.095905 msecs" | |
"Elapsed time: 7.197836 msecs" | |
"Elapsed time: 0.213017 msecs" | |
"Elapsed time: 0.305425 msecs" | |
"Elapsed time: 0.528499 msecs" | |
"Elapsed time: 0.696306 msecs" | |
"Elapsed time: 0.851463 msecs" | |
"Elapsed time: 0.920479 msecs" | |
"Elapsed time: 9.919764 msecs" | |
"Elapsed time: 3.949332 msecs" | |
"Elapsed time: 3.089921 msecs" | |
"Elapsed time: 10.964126 msecs" | |
"Elapsed time: 11.655877 msecs" | |
"Elapsed time: 24.734406 msecs" | |
"Elapsed time: 22.14043 msecs" | |
"Elapsed time: 44.512011 msecs" | |
"Elapsed time: 86.73529 msecs" | |
"Elapsed time: 162.007084 msecs" | |
"Elapsed time: 288.258587 msecs" | |
"Elapsed time: 562.020576 msecs" | |
"Elapsed time: 1130.043319 msecs" | |
"Elapsed time: 12352.813871 msecs" | |
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
user=> (clojure-version) | |
"1.5.0" | |
user=> (require '[clojure.core.reducers :as r]) | |
nil | |
user=> (require '[clojure.math.numeric-tower :as math]) | |
nil | |
user=> (for [n (range 0 26)] | |
#_=> (let [v (vec (range 0 (math/expt 2 n)))] | |
#_=> (do (System/gc) | |
#_=> (time (r/reduce + (r/filter even? (r/map #(mod % 2) v))))))) | |
("Elapsed time: 1.536299 msecs" | |
"Elapsed time: 0.089074 msecs" | |
"Elapsed time: 0.079071 msecs" | |
"Elapsed time: 0.165214 msecs" | |
"Elapsed time: 0.401171 msecs" | |
"Elapsed time: 0.097992 msecs" | |
"Elapsed time: 0.172648 msecs" | |
"Elapsed time: 0.359933 msecs" | |
"Elapsed time: 0.683764 msecs" | |
"Elapsed time: 1.033006 msecs" | |
"Elapsed time: 0.929602 msecs" | |
"Elapsed time: 1.645276 msecs" | |
"Elapsed time: 2.06392 msecs" | |
"Elapsed time: 1.898878 msecs" | |
"Elapsed time: 2.598645 msecs" | |
"Elapsed time: 3.811867 msecs" | |
"Elapsed time: 6.532202 msecs" | |
"Elapsed time: 13.175139 msecs" | |
"Elapsed time: 14.516936 msecs" | |
"Elapsed time: 31.242769 msecs" | |
"Elapsed time: 67.136573 msecs" | |
"Elapsed time: 97.765018 msecs" | |
"Elapsed time: 187.930317 msecs" | |
"Elapsed time: 382.015819 msecs" | |
"Elapsed time: 759.21498 msecs" | |
"Elapsed time: 1502.650795 msecs" | |
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment