Created
April 4, 2013 14:26
-
-
Save pbalduino/5310785 to your computer and use it in GitHub Desktop.
Type hint in Clojure
This file contains hidden or 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
(defn len [x] | |
(.length x)) | |
(defn len2 [^String x] | |
(.length x)) | |
(time (reduce + (map len (repeat 1000000 "asdf")))) | |
; "Elapsed time: 8711.592674 msecs" | |
(time (reduce + (map len2 (repeat 1000000 "asdf")))) | |
; "Elapsed time: 838.759954 msecs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment