[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why Octave is a bit slow
From: |
Richard Crozier |
Subject: |
Re: Why Octave is a bit slow |
Date: |
Fri, 28 Apr 2017 08:29:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 28/04/17 07:59, Mudit Sharma wrote:
All,
I was recently visiting this page about Julia ( language ) :
https://julialang.org/
and came to know that Octave is slower as compared to others ( please
see the table given on the page ).
I would like to know why Octave becomes slower at times and what can be
done to make it faster ?
--
Mudit
Probably because the benchmarks mostly use looped code which Octave is
not optimised for. Octave would probably not perform so badly with code
optimised for it, e.g. vectorised, for example it is much faster on the
matrix multiplication. However, another reason for the difference is the
lack of JIT functionality in Octave. If you have the capability or
funding to bring this to Octave it would be a fantastic addition!
I had a look at their benchmark code, here:
https://github.com/JuliaLang/julia/blob/master/test/perf/micro/perf.m
as one example, pisum, has a vectorised version which they currently
don't mention:
comparing in Octave, their own two benchmark codes on my machine:
>> function s = pisumvec(ignore)
a = [1:10000];
for j=1:500
s = sum( 1./(a.^2));
end
end
>> function sum = pisum(ignore)
sum = 0.0;
for j=1:500
sum = 0.0;
for k=1:10000
sum = sum + 1.0/(k*k);
end
end
end
>> tic; pisum; toc;
Elapsed time is 10.2683 seconds.
>> tic; pisumvec; toc;
Elapsed time is 0.0357349 seconds.
Regards,
Richard
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.