Hello I was comparing the performance of two snippets of MATLAB (running on 
Octave) and Julia code on Windows. 

MATLAB code:

n=1000;
a=rand(n,n);

tic
for i=1:10000
b(1:n,1:n)=a(1:n,1:n);
%b=a;
end
toc

JULIA Code: 

n=1000;
b = Array(Float64,n,n);
a=rand(n,n);

tic();
for i=1:10000
  b[1:n,1:n]=a[1:n,1:n];
  #b=a;
end
toc();
  
I understand that both the statements in the loop are b=a, but I decided to 
index the arrays and see what happened. 

The MATLAB code takes 0.22 seconds (on Octave ) whereas the JULIA code 
takes between 80 to 100 seconds (varies every time). 

I think Octave is performing some simple optimization here, and I think 
Julia might benefit from the same. 

Version info: Octave 3.6.4 and Julia 0.4.0-dev (but I saw the same happen 
in 0.3.5 too)


Reply via email to