I doubt that rand(Bool) is any slower, since randbool() calls rand(Bool). 
It is worth filing this as a performance regression.

-viral

On Monday, January 5, 2015 9:41:45 PM UTC+5:30, lapeyre....@gmail.com wrote:
>
>  It may be in part the implementation of the RNG. I think it is also in 
> part whether the abstraction is optimized away.
> Notice that Julia v0.3 is faster than v0.4. This is probably randbool() 
> vs. rand(Bool).
>
> On Monday, January 5, 2015 4:50:56 PM UTC+1, Isaiah wrote:
>>
>> Very neat. Just in case this gets posted to the interwebz, it is worth 
>> pointing out that the performance advantage for Julia can probably be 
>> explained by differences in the underlying RNG. We use dsFMT, which is 
>> known to be one of (if not the?) fastest MT libraries around. I could not 
>> find any published comparisons in a quick google, but based on this test 
>> harness [1], dsFMT may be significantly faster than std::mt19937:
>>
>> ```
>> ihnorton@julia:~/tmp/cpp-random-test$ ./random-real
>> C++11 : 2.34846
>> Boost : 0.371674
>> dSFMT : 0.281255
>> GSL   : 0.649981
>> ```
>>
>> [1] https://github.com/yomichi/cpp-random-test
>>
>>
>> On Mon, Jan 5, 2015 at 10:12 AM, <lapeyre....@gmail.com> wrote:
>>
>>> Oh, and, (I forgot to mention!)  the Julia code runs much faster.
>>>
>>>
>>> On Monday, January 5, 2015 3:56:07 PM UTC+1, lapeyre....@gmail.com 
>>> wrote:
>>>>
>>>> Hi, here is a comparison of Julia and C++ for simulating a random walk 
>>>> <https://github.com/jlapeyre/ranwalk-Julia-vs-Cxx>.
>>>>
>>>> It is the first Julia program I wrote. I just pushed it to github.
>>>>
>>>> --John
>>>>
>>>>
>>

Reply via email to