(set! *warn-on-reflection* true)
(set! *unchecked-math* true)
(defn sk [^longs vs ^booleans ss]
(fn ^long [^long k]
(if (aget ss k)
(aget vs k)
(let [ans (if (< k 56)
(- (mod (+ 100003 (- (* k 200003)) (* 300007 k k k))
1000000) 500000)
(- (mod (+ (aget vs (- k 24))
(aget vs (- k 55))) 1000000)
500000))]
(do (aset vs k (long ans))
(aset ss k true)
ans)))))
(comment
(time
(dorun
(map (sk (long-array 4000001)
(boolean-array 4000001))
(range 100000))))
)
Not sure if this preserves your code. On my machine running 1.3.0-beta1 this
takes 300-400ms once the JVM has warmed up.
David
--
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