On Tuesday, May 3, 2011 3:20:25 PM UTC-4, David Nolen wrote:
>
> On Tue, May 3, 2011 at 2:51 PM, Ken Wesson <kwes...@gmail.com> wrote:
>
>> It's optimizing your loop away, or else you're using ridiculously
>> powerful hardware.
>>
>> user=> (time (dotimes [_ 1000000] (Math/ceil (rand))))
>> "Elapsed time: 142.86748 msecs"
>> nil
>
>
> Maybe, maybe not: 
>

Either way, it's got a weird profile (increasing, but not monotonically):

user=> (doseq [n (map #(Math/pow 10 %) (range 10))] (time (dotimes [_ n] 
(Math/ceil 0.1))))
"Elapsed time: 0.238077 msecs"
"Elapsed time: 0.007346 msecs"
"Elapsed time: 0.030386 msecs"
"Elapsed time: 0.255107 msecs"
"Elapsed time: 10.399609 msecs"
"Elapsed time: 5.677462 msecs"
"Elapsed time: 1.423789 msecs"
"Elapsed time: 9.779539 msecs"
"Elapsed time: 65.505686 msecs"
"Elapsed time: 651.333768 msecs"
nil

-- 
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

Reply via email to