This link reminded me of this discussion. http://www.cnn.com/2009/US/07/15/quadrillion.dollar.glitch/index.html?iref=newssearch
as Rich said, unchecked is generally a bad idea. :) On Wed, Jul 15, 2009 at 10:24 PM, Rich Hickey<richhic...@gmail.com> wrote: > > > > On Jul 15, 2:22 pm, John Harrop <jharrop...@gmail.com> wrote: >> 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. > > Frantisek's solution is the right way, and will run within 5-10% of > the Java version, Going to unchecked-* is generally not worth it and I > don't recommend it. You should only use it when you desire the > wrapping behavior. > > Rich > > > > -- Omnem crede diem tibi diluxisse supremum. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---