Actually, let me correct the profiling times - I did that again, and times
are much larger in session two. pretty much everhthing takes longer in
session 2. here's an example for the function "ufun":
275 ...julia/src/solver.jl; ufun; line: 397 # session 1
1206 ...julia/src/solver.jl; ufun; line: 397 # session 2
function ufun(x::Float64,own::Int,mc::Float64,def::Bool,p::Param)
r = p.imgamma * x^p.mgamma + own*p.xi - def*p.lambda - mc
end
On Friday, 27 June 2014 11:20:58 UTC+1, Florian Oswald wrote:
>
> Hi Tomas
> we might just have missed each other, but I added that I actually took
> care of this by running things twice: no change.
>
> On Friday, 27 June 2014 11:15:26 UTC+1, Tomas Lycken wrote:
>>
>> Are you sure you're not including compilation in those timings? Since
>> Julia is JIT-compiled ("just-in-time"), the funcitons aren't compiled until
>> you use them the first time. Thus, you need to do a warmup call first, that
>> calls the method with arguments of the same type as those you want to time
>> the function for.
>>
>> // T
>>
>> On Friday, June 27, 2014 12:11:02 PM UTC+2, Florian Oswald wrote:
>>>
>>> Hi all,
>>> I found some strange behaviour when running my code. I open 2 clean
>>> julia sessions and do the following:
>>>
>>>
>>>
>>> # session 1
>>> home = ENV["HOME"]
>>> cd("$home/git/migration/julia")
>>>
>>> include("src/mig.jl")
>>> p = mig.Param(2)
>>> m = mig.Model(p)
>>> @time mig.solve!(m,p)
>>>
>>> elapsed time: 9.358865389 seconds (236857932 bytes allocated)
>>>
>>> # session 2
>>> home = ENV["HOME"]
>>> cd("$home/git/migration/julia")
>>> include("src/mig.jl")
>>>
>>> mig.mywrap()
>>>
>>> elapsed time: 18.051932747 seconds (226522796 bytes allocated)
>>>
>>> the definition of mywrap is
>>>
>>> function mywrap()
>>> p = mig.Param(2)
>>> m = mig.Model(p)
>>> @time mig.solve!(m,p)
>>> end
>>>
>>> I thought this is identical? I looked at the @profile of both sessions,
>>> and the profile timings of mig.solve! (the main computation function) are
>>> actually lower in session 2 (inside the wrap) than in session 1. I would
>>> have expected the reverse?
>>>
>>>