Some more String-specific timings, modified to avoid inlining differences between alternatives:
(let [iterations 1e8] (time (dotimes [_ iterations] (= 0 (.length (.substring "x" 1))))) (time (dotimes [_ iterations] (seq (.substring "x" 1))))) "Elapsed time: 3125.125 msecs" "Elapsed time: 8198.331 msecs" (let [iterations 1e8] (time (dotimes [_ iterations] (= 0 (count (.substring "x" 1))))) (time (dotimes [_ iterations] (seq (.substring "x" 1))))) "Elapsed time: 9586.196 msecs" "Elapsed time: 8006.184 msecs" I also tried using String.intern() so that `identical?` could be used, that took longer than any of the other options. Note: I run each of these several times and only include the results once they are consistent between runs. This avoids results tainted by compilation and jit overhead. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en