Sorry, it was a silly mistake, I never meant to have a global variable. I simplified the code I was working on to benchmark and post and ended up introducing this "bug". Thanks for the answers, I don't think I'll use global variables, but if I do, I'll declare them as const.
Best. On Tuesday, February 3, 2015 at 2:15:40 PM UTC-2, Yuuki Soho wrote: > > The reason why test_1 is slower than test_2 is that you forgot to pass σ > as a parameter in test_1 definition, so Julia looks for a global variable > instead. > > In general don't hesitate to add type annotation to your functions, it > often helps to prevent types problems (e.g. function > test_1(μ::Float64,Δσ::Float64,σ::Float64) > ). > > > >
