This runs in 0.3 
seconds: 
https://github.com/KristofferC/calcnet/commit/2c252a31c34eb92842310b31d753a64727b95875
 
but I havent checked if the result is the same hehe. Should give you a feel 
how to write fast code in Julia though.

Bottleneck now is all the repmats.

On Sunday, September 20, 2015 at 4:49:55 PM UTC+2, Daniel Carrera wrote:
>
> Uhmm... I get an error:
>
> ERROR: @code_warntype not defined
>
> Do I need to update Julia or something? I have version 0.3.11.
>
> On 20 September 2015 at 16:14, Valentin Churavy <[email protected] 
> <javascript:>> wrote:
>
>> take a look at 
>> @code_warntype calc_net(0, 0, 0, Dict{String,Float64}(), Dict{String,
>> Float64}())
>>
>> It tells you where the compiler has problems inferring the types of the 
>> variables.
>>
>> Problematic in this case is
>>   b_hist::Any
>>   b_hist_col2::Any
>>   numB::Any
>>   b_hist_col2_A::Any
>>   b_hist_col2_B::Any
>>   total_b_A_::Any
>>   total_b_B_::Any
>>   net_::Any
>>
>>
>> On Sunday, 20 September 2015 22:55:50 UTC+9, Daniel Carrera wrote:
>>>
>>> Hi Steven,
>>>
>>> I am not the OP, I am trying to help the OP with his code. Anyway, the 
>>> first thing I did was replace Dict{Any,Any} by the more explicit 
>>> Dict{String,Float64} but that didn't help. I did not think to try a 
>>> composite type. I might try that later. It would be interesting to figure 
>>> out why the OP's code is so much slower in Julia.
>>>
>>> Cheers,
>>> Daniel.
>>>
>>>
>>> On 20 September 2015 at 15:20, Steven G. Johnson <[email protected]> 
>>> wrote:
>>>
>>>> Daniel, you are still using a Dict of params, which kills type 
>>>> inference. Pass parameters directly or put them in (typed) fields of a 
>>>> composite type.
>>>>
>>>> (On the other hand, common misconception: there is no performance need 
>>>> to declare the types of function arguments.)
>>>
>>>
>>>
>

Reply via email to