On Wed, Jul 15, 2009 at 11:39 AM, B Smith-Mannschott
<bsmith.o...@gmail.com>wrote:

> An explicit loop with some type hints is faster, though likely not as
> fast as Java:
>
> (defn sum-of-range-4 [range-limit]
>  (loop [i (int 1) s (long 0)]
>    (if (< i range-limit)
>      (recur (inc i) (+ s i))
>      s)))
>
> This took 20.275s for the same scenario.


Use unchecked-add and unchecked-inc in place of + and inc and you should get
equivalent speed.

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