I'm having a bit of trouble getting type hinting to work. I've got
these equal sized seqs that I'm mapping into a function. I'm running
the function twice in a row in an inner loop that is seriously
dragging down performance.
(let [ newv1 (time (doall (map (fn [v u I] (+ ^java.lang.Double v (*
0.5 (+ (* (+ (* 0.04 ^java.lang.Double v) 5) ^java.lang.Double v) 140
(- ^java.lang.Double u) ^java.lang.Double I)))) v u I)))
newv (time (doall (map (fn [v u I] (+ v (* 0.5 (+ (* (+ (* 0.04 v)
5) v) 140 (- u) I)))) newv1 u I)))]
I've tried without type hints, with type hints, different ways of
doing the type hints, but I cannot explain the results that I'm
seeing. With all of the variations I've tried, I've always seen
timing like this:
"Elapsed time: 49.876243 msecs"
"Elapsed time: 0.179701 msecs"
What am I missing here? Is the compiler getting some advantage to
executing the same function twice that cannot be gained in the first
execution?
--
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