Created
November 30, 2011 13:14
-
-
Save acardona/1409021 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my.numeric.test | |
(:import [fiji.scripting Weaver])) | |
(def a (ref nil)) | |
; Compile once | |
(def w (Weaver/inline | |
"int n = ((Number)ref.deref()).intValue(); | |
double sum = 0; | |
for (int i=0; i<n; ++i) { | |
sum += Math.random(); | |
} | |
return sum;" | |
{"ref" a} | |
Double true)) | |
; Run many times by altering 'a' to new numbers (here the same is used every time) | |
(println | |
(dotimes [i 10] | |
(dosync (alter a (fn [_] 300000))) | |
(time (.call w)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment