On Feb 10, 2009, at 6:37 PM, Timothy Pratley wrote:
> > I would have expected the mult to be a performance hit, but my overly > simple tests show it performing better: > user=> (time (dotimes [i 1000000] (zero? (* 5 11)))) > "Elapsed time: 183.358706 msecs" > user=> (time (dotimes [i 1000000] (or (< 5 0 11) (< 11 0 5)))) > "Elapsed time: 682.586025 msecs" > > In practice it doesn't seem to make much difference overall: > user=> (time (dotimes [i 1000000] (map #(mod2 % 3) (range -9 9)) )) > "Elapsed time: 966.868765 msecs" > user=> (time (dotimes [i 1000000] (map #(mod42 % 3) (range -9 9)) )) > "Elapsed time: 938.675334 msecs" > > But the multiply seems to have the edge in both expression and speed. > > The real hit would come with bignums, no? But as far as the routine use of MOD goes we're probably talking about fixnums > 99% of the time. Aloha, David Sletten --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---