[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51403] isequal is slow
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #51403] isequal is slow |
Date: |
Thu, 6 Jul 2017 11:36:05 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0 |
Follow-up Comment #1, bug #51403 (project octave):
With the profiler and by recursively comparing each element of your struct, it
doesn't look to me like there is one particular bottleneck, just the basic
structure of __isequal__, multiplied because it is called recursively 197
times for each call on A.
I get a runtime of about 0.036 seconds for each 100 calls to isequal(x,x)
where x is a scalar double or double matrix of relatively small dimensions. I
get the same runtime for a small string.
If you multiply that out, 0.036 * 198 is about 7 seconds, which is the runtime
I can confirm with the original example.
Same shown for each field of the A struct:
>> tic; for i=1:100; isequal (A.field1, A.field1); endfor; toc
Elapsed time is 2.16991 seconds.
>> tic; for i=1:100; isequal (A.field2, A.field2); endfor; toc
Elapsed time is 2.18113 seconds.
>> tic; for i=1:100; isequal (A.field3, A.field3); endfor; toc
Elapsed time is 0.0350201 seconds.
>> tic; for i=1:100; isequal (A.field4, A.field4); endfor; toc
Elapsed time is 2.17106 seconds.
>> tic; for i=1:100; isequal (A.field5, A.field5); endfor; toc
Elapsed time is 0.0386372 seconds.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51403>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/