Skip to content

Instantly share code, notes, and snippets.

@mschuetz
Created September 3, 2014 07:34
Show Gist options
  • Save mschuetz/fb98c6e1d926ed4a589d to your computer and use it in GitHub Desktop.
Save mschuetz/fb98c6e1d926ed4a589d to your computer and use it in GitHub Desktop.
clojure call performance
(ns funcall_perf)
(defn len1a [^String foo] (.length foo))
(defn len1b [foo] (.length foo))
(defn len2a [^String foo] (count foo))
(defn len2b [foo] (count foo))
; warm up
(doseq [func [len1a len1b len2a len2b]]
(dotimes [n 1000000]
(func "asdf")))
(doseq [func [len1a len1b len2a len2b]]
(time
(dotimes [n 1000000]
(func "asdf"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment