You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mixing the long (in clojure) index with the double mult is hitting a slow path and invoking clojure.lang.Numbers
(defncalc-pi-leibniz2"Eliminate mixing of long/double to avoid clojure.numbers invocations."
^double
[^long rounds]
(let [end (+2 rounds)]
(loop [i 2.0 x 1.0 pi 1.0]
(if (== i end)
(*4.0 pi)
(let [x (- x)]
(recur (inc i) x (+ pi (/ x (dec (*2 i))))))))))
leibniz=> (c/quick-bench (calc-pi-leibniz rounds))
Evaluation count : 6 in 6 samples of 1 calls.
Execution time mean : 575.352216 ms
Execution time std-deviation : 10.070268 ms
Execution time lower quantile : 566.210399 ms ( 2.5%)
Execution time upper quantile : 588.772187 ms (97.5%)
Overhead used : 1.884700nsnil
leibniz=> (c/quick-bench (calc-pi-leibniz2 rounds))
Evaluation count : 6 in 6 samples of 1 calls.
Execution time mean : 158.509049 ms
Execution time std-deviation : 759.113165 ╡s
Execution time lower quantile : 157.234899 ms ( 2.5%)
Execution time upper quantile : 159.205374 ms (97.5%)
Overhead used : 1.884700nsnil
The text was updated successfully, but these errors were encountered:
Mixing the long (in clojure) index with the double mult is hitting a slow path and invoking clojure.lang.Numbers
The text was updated successfully, but these errors were encountered: