If you do not change length of xprime or use it later for another purposes then just update existing array instead of re-allocating each time. Also, using global variables in the innermost loop is very inefficient in Julia. It would be good to revise the code in the light of this tips from docs http://docs.julialang.org/en/release-0.4/manual/performance-tips/
- [julia-users] Julia vs Matlab: interpolation and looping pokerhontas2k8
- [julia-users] Re: Julia vs Matlab: interpolation and ... Andrew
- [julia-users] Re: Julia vs Matlab: interpolation ... Tomas Lycken
- [julia-users] Re: Julia vs Matlab: interpolat... pokerhontas2k8
- [julia-users] Re: Julia vs Matlab: interp... Lutfullah Tomak
- Re: [julia-users] Re: Julia vs Matlab: in... Isaiah Norton
- [julia-users] Re: Julia vs Matlab: interp... Andrew
- [julia-users] Re: Julia vs Matlab: i... pokerhontas2k8
- [julia-users] Re: Julia vs Matla... Lutfullah Tomak
- [julia-users] Re: Julia vs M... Lutfullah Tomak
- [julia-users] Re: Julia vs M... Andre Bieler
- [julia-users] Re: Julia vs M... Lutfullah Tomak
- [julia-users] Re: Julia vs M... pokerhontas2k8
- [julia-users] Re: Julia vs Matlab: interpolation and ... nuffe