[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58445] significant slow down in dev version f
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #58445] significant slow down in dev version for certain cellfun invocations |
Date: |
Tue, 26 May 2020 11:08:16 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Update of bug #58445 (project octave):
Severity: 3 - Normal => 4 - Important
Status: None => Confirmed
_______________________________________________________
Follow-up Comment #1:
Confirmed. This is yet another example of the reason why we need a set of
performance tests, as well as the tests for correct function that we already
have, so that as developers we don't accidentally introduce massive
slowdowns.
I thought at first it might be a problem with for loops, because your tic/toc
bracket included the cellfun call and the for loop. There was also a
repeatability issue in that the test used random data so there was the
possibility that the data for one version was longer and required more
processing. I wrote a new performance benchmark which is attached as
tst_cellfun_perf.m and shown below.
nrep = 1e3;
## Load same test variable for repeatability
load cellfun.var;
## Call function once so all m-files necessary are parsed.
## Otherwise, first time through loop will be slower than others.
cellfun ('numel', aa);
bm1 = zeros (nrep, 1);
for j = 1 : nrep
tic;
cellfun ('numel', aa);
bm1(j) = toc;
end
fprintf ('cellfun(''numel''): %g secs\n', sum (bm1));
bm2 = zeros (nrep, 1);
for j = 1 : nrep
tic;
cellfun(@numel, aa);
bm2(j) = toc;
end
fprintf('cellfun(@numel): %g secs\n', sum (bm2));
The data for the test is created just once with
aa = num2cell (rand (1000,3), 2);
save -binary cellfun.var
which is also attached as mk_cellfun_tst_var.m.
Results are
6.0.90
------------------------------------------------------------
cellfun('numel'): 0.0420563 secs
cellfun(@numel): 17.388 secs
5.2.0
------------------------------------------------------------
cellfun('numel'): 0.019412 secs
cellfun(@numel): 0.025914 secs
The difference in performance between the two versions for @numel is 671X!
(file #49176, file #49177)
_______________________________________________________
Additional Item Attachment:
File name: tst_cellfun_perf.m Size:0 KB
<https://savannah.gnu.org/file/tst_cellfun_perf.m?file_id=49176>
File name: mk_cellfun_tst_var.m Size:0 KB
<https://savannah.gnu.org/file/mk_cellfun_tst_var.m?file_id=49177>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58445>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #58445] significant slow down in dev version for certain cellfun invocations, A.R. Burgers, 2020/05/25
- [Octave-bug-tracker] [bug #58445] significant slow down in dev version for certain cellfun invocations,
Rik <=
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Rik, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Rik, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, John W. Eaton, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Rik, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, John W. Eaton, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Philip Nienhuis, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Rik, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Philip Nienhuis, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, Rik, 2020/05/26
- [Octave-bug-tracker] [bug #58445] significant slow down in stable version for cellfun invocations which use function handles, John W. Eaton, 2020/05/27