Will take a look at the bigml/sampling library...

On Tuesday, June 3, 2014 7:52:06 PM UTC-4, Jose M. Perez Sanchez wrote:
>
>
> Thank you very much. I'm using the Colt random number generator directly. 
> I've managed to reduce computing time by orders of magnitude using type 
> hints and java arrays in some critical parts. I haven't had the time to 
> write a report on this for the list, since have been busy with other 
> projects, but this will come as well as the release of the source code.
>
> Thanks again,
>
> Jose.
>
> On Tuesday, June 3, 2014 1:46:55 PM UTC-4, Mars0i wrote:
>>
>> Jose,
>>
>> This is an old thread, and whatever problems you might be dealing with 
>> now, they're probably not the same ones as when the thread was active.  
>> However, I think that if parallel code uses the built-in Clojure random 
>> number functions, there is probably a bottleneck in access to the RNG.  
>> With Criterium's bench function on an 8-core machine:
>>
>> (def ones (doall (repeat 1000 1)))
>> (bench (def _ (doall (map rand ones))))   ; 189 microseconds average time
>> (bench (def _ (doall (pmap rand ones))))  ; 948 microseconds average time
>>
>> One solution that doesn't involve generating the numbers in advance is to 
>> create separate RNGs, as discussed in this thread 
>> <https://groups.google.com/forum/#!searchin/clojure/random/clojure/cRVS19PB06E/8FsmtsYx6SkJ>.
>>   
>> This is a strategy that I am starting to explore.
>>
>> Related notes for anyone interested:
>>
>> As of Incanter 1.5.5 at least some functions such as sample are based on 
>> Clojure's bult-in rand, so they would have this problem as well.
>>
>> clojure.data.generators allows rebinding the RNG, and provides 
>> reservoir-sample and a replacement for the default rand-nth.
>>
>> The bigml/sampling 
>> <https://github.com/bigmlcom/sampling/tree/master/src/bigml/sampling> 
>> library provides sampling and random number functions with optional 
>> generation of a new RNG.
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to