octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why Octave is a bit slow


From: Juan Pablo Carbajal
Subject: Re: Why Octave is a bit slow
Date: Sat, 29 Apr 2017 00:38:32 +0200

On Fri, Apr 28, 2017 at 9:29 AM, Richard Crozier <address@hidden> 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.
>
>
Has somebody already posted this code on their repository so they have
better benchmarks?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]