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 |
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. |
On Fri, Apr 28, 2017 at 9:29 AM, Richard Crozier <[hidden email]> wrote:
> 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. > > better benchmarks? |
In reply to this post by Mudit Sharma
I've done some benchmarks last year. Here is the link : MATLAB / Octave / Scilab benchmarks. However, I didn't compare with Julia because there was no Julia code for the benchmark programs I used. As you can see in these benchmarks, Octave is only slow when using loops. Vectorizing loops can be a solution. |
Free forum by Nabble | Edit this page |