Created
December 14, 2015 17:12
-
-
Save domgetter/5118978273fc61cceb69 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
;; Timings are after the JVM had done all possible optimizations | |
(defn asdf [a b] (+ a b)) | |
(dotimes [x 1000] (time (dotimes [x 1000000] (+ 2 3)))) ;; "Elapsed time: 0.280724 msecs" | |
(dotimes [x 1000] (time (dotimes [x 1000000] (asdf 2 3)))) ;; "Elapsed time: 1.114747 msecs" | |
(defn asdf ^long [^long a ^long b] (+ a b)) | |
(dotimes [x 1000] (time (dotimes [x 1000000] (+ 2 3)))) ;; "Elapsed time: 0.280724 msecs" | |
(dotimes [x 1000] (time (dotimes [x 1000000] (asdf 2 3)))) ;; "Elapsed time: 0.57473 msecs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment