bugGNU Octave - Bugs: bug #57279, Slow plotting of multiple lines

 
 

bug #57279: Slow plotting of multiple lines

Submitter:  Milan <mxarko>
Submitted:  Wed 20 Nov 2019 04:05:45 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 22 Dec 2019 10:05:27 PM UTC, comment #5: 

I have some new interesting findings. When I started this topic, Octave 4.2.2. had plotted fast. After my activities which I exposed I didn't manage to have it plot fast again. It had been very strange to me. Now I think that those my changes of the system accidentally took place in the same time as some change in Octave's behaviour, so Octave wouldn't plot fast any more even if I had not touched it. I don't know what caused that change, probably some change in the OS's behaviour due to updates. The fact that Octave 4.2.2. doesn't plot fast any more even on another PC, also with Linux Mint, which I haven't messed with in the meantime, supports that assumption.

Anyway, now I find that Octave 4.2.2. fills polygons fast, although it plots slow! I modified my test program, so it accepts even the second argument, which has logical meaning: apply "plot", not "fill". I measured plotting and filling of Octave 5.1.0. via Flatpak and 4.2.2. on Mint 19.3 Cinnamon and of Octave 4.4.1. on MX-19 Linux, all in VirtualBox.

New test program (0 means "fill"):

function grafTs(k,p)
hf=figure;
axis auto
axis equal
hold on
set(hf,'Renderer','painters')
cx=zeros(3,1e5);
cy=cx;
%k=55%;125%
s=sqrt(3)/2;
tx=[0;1;.5];
ty=[0;0;s];
b='c';
o=0;
for x=0:k-1
  for y=0:k-1-x
    o+=1;
    cx(:,o)=x+y/2+tx;
    cy(:,o)=s*y+ty;
end,end
cx=cx(:,1:o);
cy=cy(:,1:o);
tic
if p
  plot(cx,cy,b)
else
  fill(cx,cy,'w','EdgeColor','g')%fill%plot
end
toc


Octave 4.2.2. on Mint plotting and filling times:

>> grafTs(35,0)
Elapsed time is 0.107815 seconds.
>> grafTs(35,0)
Elapsed time is 0.0381899 seconds.
>> grafTs(35,0)
Elapsed time is 0.0344501 seconds.
>> grafTs(35,1)
Elapsed time is 20.0317 seconds.
>> grafTs(35,1)
Elapsed time is 21.6269 seconds.
>> grafTs(35,1)
Elapsed time is 22.7793 seconds.
>>


Octave 5.1.0. via Flatpak on Mint:

>> grafTs(35,0)
Elapsed time is 34.8323 seconds.
>> grafTs(35,0)
Elapsed time is 34.2146 seconds.
>> grafTs(35,1)
Elapsed time is 27.41 seconds.
>> grafTs(35,1)
Elapsed time is 28.1357 seconds.
>>


Octave 4.2.2. on Mint, after uninstalling 5.1.0. and reinstalling (maybe it is interesting that the results are slightly different than at first installation):

>> grafTs(35,0)
Elapsed time is 0.047008 seconds.
>> grafTs(35,0)
Elapsed time is 0.0826879 seconds.
>> grafTs(35,1)
Elapsed time is 15.3278 seconds.
>> grafTs(35,1)
Elapsed time is 15.9453 seconds.
>> grafTs(35,1)
Elapsed time is 16.7367 seconds.
>>


Octave 4.4.1. on MX:

>> grafTs(35,0)
Elapsed time is 15.117 seconds.
>> grafTs(35,0)
Elapsed time is 16.037 seconds.
>> grafTs(35,0)
Elapsed time is 15.8229 seconds.
>> grafTs(35,1)
Elapsed time is 18.9274 seconds.
>> grafTs(35,1)
Elapsed time is 19.4115 seconds.
>>


Milan <mxarko>
Sat 23 Nov 2019 06:24:11 PM UTC, comment #4: 

I forgot to mention that naccking out the cset is not actuelly an option since it provokes a bunch (9) of test failures.

Pantxo Diribarne <pantxo>
Group Member
Sat 23 Nov 2019 05:59:53 PM UTC, comment #3: 

I bisected and the cset that trigerred this increase dependence of the time needed to plot lines on the number of objects already present is

26316 (522a70bb738f) Fix order of execution of graphic properties (bug #55321)


If I backout this cset, the timing is still 0.35ms for 100 lines, but doesn't increase with the number of calls. This still leaves us with a huge increase (0.012ms -> 0.35 ms) between 4.2 and 6.0.


Pantxo Diribarne <pantxo>
Group Member
Wed 20 Nov 2019 09:36:52 PM UTC, comment #2: 

I used the following simple code for testing.


figure (99, "visible", "off"); clf;
for ii = 1:20
  tic; arrayfun (@() __go_line__ (gca (),"xdata", [0, 1], "ydata", [0, 1]), 1:100); tt(ii) = toc
endfor
plot (tt);
xlabel "Number of calls"
ylabel "time for 100 lines (s)"
print timings.png


On my linux mint 19.2 box, Octave 4.2 is incredibly much faster at creating line objects than Octave 6.0: ~12ms for 100 lines against ~320ms. More important, the number of objects already present in the axes does not significantly affect the timing in 4.2 while it does in Octave 6.0. See the attached two files



Pantxo Diribarne <pantxo>
Group Member
Wed 20 Nov 2019 08:08:57 PM UTC, comment #1: 

I can confirm that it is also slow in dev.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Wed 20 Nov 2019 04:05:45 PM UTC, original submission:  

Octave plotting became much slower since v. 4.2.2. I have four OS-es installed - Linux Mint 19.2 Cinnamon (kernel 4.15), Debian 10.1 Cinnamon (kernel 4.19), MX Linux 19 (kernel 4.19), Windows 10 - and installed Octave on all of them. Corresponding versions are: Mint - 4.2.2, Debian - 4.4.1, MX - 4.4.1, Windows - 5.1.0. When I run plotting test example (shown below) by "grafTs(35)" only on Mint it takes less than 1 s to execute and on the other systems it takes around 14 s. Moreover, if I input bigger argument, say 55, on Mint the time remains small (around 0.5 s) and on the other systems it goes up to 50 s. It doesn't make big difference if the graphics toolkit is Qt, Fltk or Gnuplot. Just to be clear: I measure the time not for the first run, i.e. the first figure window, but for the runs from the second onwards.

These are pretty fresh installations, both the OS-es and Octave, for which I didn't install any additional packages. But I did install the recommended packages.

For testing purpose, I installed Octave 5.1.0 on Mint via Flatpak, and it is slow like the other newer versions, from 4.4.1 onwards. Until now I didn't find the way to revert to the original 4.2.2 installation, because now, after purging the Flatpak one, even 4.2.2 is slow. But it is another problem, which I don't observe here.

Is there a solution, to bring the speed of plotting in the newer versions of Octave to the one in 4.2.2, I primarily mean for Linux? And will OOTB plot in the following versions of Octave again be as fast as it once was?


function grafTs(k)
hf=figure;
ha=gca;
axis auto
axis equal
hold on
set(hf,'Renderer','painters')
cx=zeros(3,1e5);
cy=cx;
%k=55%;125%
e=[1;1;1];
s=sqrt(3)/2;
tx=[0;1;.5];
ty=[0;0;s];
b='c';
o=0;
for x=0:k-1
  for y=0:k-1-x
    o=o+1;
    cx(:,o)=(x+y/2)*e+tx;
    cy(:,o)=s*y*e+ty;
end,end
cx=cx(:,1:o);
cy=cy(:,1:o);
tic
plot(cx,cy,b,'Parent',ha)%fill
toc


Milan <mxarko>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #47908:  timings_4.2.png added by pantxo (23KiB - image/png)
file #47909:  timings_6.0.png added by pantxo (25KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by mxarko (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-20 pantxo Attached File- Added timings_4.2.png, #47908
        Attached File- Added timings_6.0.png, #47909
        StatusNone Confirmed
        Release4.4.1 dev

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code