-
-
Save borkdude/33d79402e689460e62d6 to your computer and use it in GitHub Desktop.
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> (def my-transducer (comp (filter odd?) (filter odd?) (filter odd?))) | |
#'user/my-transducer | |
user> (def my-func (comp #(filter odd? %) #(filter odd? %) #(filter odd? %))) | |
#'user/my-func | |
user> (time (dotimes [x 10000] (doall (my-func (range 1000))))) | |
"Elapsed time: 2684.170568 msecs" | |
nil | |
user> (time (dotimes [x 10000] (doall (my-func (range 1000))))) | |
"Elapsed time: 2477.983258 msecs" | |
nil | |
user> (time (dotimes [x 10000] (doall (sequence my-transducer (range 1000))))) | |
"Elapsed time: 3110.309093 msecs" | |
nil | |
user> (time (dotimes [x 10000] (doall (sequence my-transducer (range 1000))))) | |
"Elapsed time: 3129.188543 msecs" | |
nil | |
user> (time (dotimes [x 10000] (into [] my-transducer (range 1000)))) | |
"Elapsed time: 2153.223321 msecs" | |
nil | |
user> (time (dotimes [x 10000] (into [] my-transducer (range 1000)))) | |
"Elapsed time: 2113.313468 msecs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment