octave-maintainers
[Top][All Lists]
Advanced

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

Re: loop performance


From: Rik
Subject: Re: loop performance
Date: Thu, 4 Jan 2018 10:34:05 -0800

On 01/04/2018 07:07 AM, John W. Eaton wrote:
> On 01/03/2018 07:09 PM, Michael D Godfrey wrote:
>> Just for information, I get a very similar ratio for dev/4.2.1. This
>> is a bigger jump than in the past. My system is an Intel NUC7i5BNH,
>> i.e. I7 CPU.
>>
>> I tried a few modifications, but the ratio stayed about the same.
>> Also, CPU usage (on 1 processor) was at just about 100% for the whole
>> time in all
>> cases.
>>
>> Is it not possible to get a trace on just  the a = a + b + 123.0 sequence?
>
> I haven't done any real profiling, but from my tests it looks like the
> evaluation of the expression is the real problem.  Comparing
>
>   t0=tic; for i=1:1000; for j=1:1000; end; end; t1=toc(t0); t1
>
> in 4.2.1 and the current dev version I see nearly identical results. Both
> were built with GCC 7.2.0 on a Debian system.
>
> jwe

I filed a bug report (https://savannah.gnu.org/bugs/index.php?52809) to
keep track of this.  Quoting from the write-up there:


The evaluation of statements seems to be much slower on the development
branch than in previous versions.

A sample script testing just a for loop is:

tic; for i=1:1000; for j=1:1000; end; end; toc

On my machine, results are roughly equivalent between 4.2.1 and the
development branch.

4.2.1 : 0.109 seconds
dev.  : 0.121 seconds

But if there is even a single variable assignment the results are far worse.

tic; for i=1:1000; for j=1:1000; a = 1.0; end; end; toc

Results:
4.2.1 : 0.218 seconds
dev.  : 1.28 seconds

--Rik



reply via email to

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