I'm facing strange difference within time of completion between lein repl
and LightTable Instarepl(LTIR). For example the following code:
(defn lazy-primes
([] (cons 2 (lazy-seq (lazy-primes 3 [ 2 ]))))
([current calculated-primes]
(loop [ [first-prime & rest-primes] calculated-primes]
(if (> (* first-prime first-prime) current)
(cons current (lazy-seq (lazy-primes
(inc current)
(conj calculated-primes current))))
(if (= 0 (mod current first-prime))
(lazy-seq (lazy-primes (inc current) calculated-primes))
(recur rest-primes))))))
(time (last (take 10001 (lazy-primes))))
in my LTIR it took:
"Elapsed time: 4535.442412 msecs"
but in lein repl
:
"Elapsed time: 431.378074 msecs"
About tenfold difference!
So, here is the question - why so big difference?
Clojure version for LTIR and lein repl
is 1.7.0
This code isn't mine, it's from codereview