Hey All,
I'm trying to print the numbers 0-999999 as fast as possible. In python,
this
for i in range(999999):
print i
runs super fast.
In clojure, even with type hints, this is slow
(def ^java.io.PrintWriter outoutout (java.io.PrintWriter. *out*))
; yes, I know this one prints to infinity. It's still slow.
(defn print1 []
(loop [num 0]
(.println outoutout ^Integer num)
(recur (unchecked-inc num))))
(defn print2 []
(dotimes [n 999999] (.println outoutout n)))
Those two functions do not have reflection warnings and are using the raw
java statements to print yet are still very slow.
How would I print the numbers 0-999999 as fast as python?
Thank you for your time.
-Sean
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en