bugGNU Octave - Bugs: bug #52584, Printing with many markers is very...

 
 

bug #52584: Printing with many markers is very slow

Submitter:  Muhali <muhali>
Submitted:  Mon 04 Dec 2017 04:59:33 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 11 Nov 2018 02:12:52 AM UTC, comment #20: 

Okay, everything seems to be explained and the performance is better for the original reporter.  Marking bug as fixed and closing report.

Rik <rik5>
Group administrator
Thu 08 Nov 2018 09:56:08 PM UTC, comment #19: 

I get timings of order 0.3 s with tst_slowprint2 for both fltk and Qt.

@Rik: the Qt toolkit now uses getframe instead of gl2ps to produce png outputs while fltk still uses gl2ps. Qt being much faster than fltk with tst_slowprint may just be an indication that -painters (eps->png) is much slower than -opengl (getframe) on your computer.

Pantxo Diribarne <pantxo>
Group Member
Thu 08 Nov 2018 03:15:55 PM UTC, comment #18: 

@pantxo: no slowdown for me anymore.

Muhali <muhali>
Tue 06 Nov 2018 06:49:05 PM UTC, comment #17: 

On my ancient Xeon (Fedora 29):

 ./run-octave -qf
octave:1> graphics_toolkit
ans = qt
octave:2> tst_slowprint
Elapsed time is 0.799074 seconds.
octave:3> tst_slowprint
Elapsed time is 0.361146 seconds.
octave:4> tst_slowprint
Elapsed time is 0.359951 seconds.

./run-octave -qf
octave:1> graphics_toolkit fltk
octave:2> tst_slowprint
Elapsed time is 1.15846 seconds.
octave:3> tst_slowprint
Elapsed time is 0.473205 seconds.
octave:4> tst_slowprint
Elapsed time is 0.455319 seconds.

===========

./run-octave -qf
octave:1> graphics_toolkit qt
octave:2> tst_slowprint2
Elapsed time is 0.708672 seconds.
octave:3> tst_slowprint2
Elapsed time is 0.247001 seconds.
octave:4> tst_slowprint2
Elapsed time is 0.243794 seconds.

./run-octave -qf
octave:1> graphics_toolkit fltk
octave:2> tst_slowprint2
Elapsed time is 0.967463 seconds.
octave:3> tst_slowprint2
Elapsed time is 0.231865 seconds.
octave:4> tst_slowprint2
Elapsed time is 0.231469 seconds.

 __opengl_info__
   version: 3.1 Mesa 18.2.4
    vendor: VMware, Inc.
  renderer: llvmpipe (LLVM 7.0, 128 bits)

Dmitri.
--




Dmitri A. Sergatskov <dasergatskov>
Tue 06 Nov 2018 04:43:52 PM UTC, comment #16: 

I still see a big difference between Qt and FLTK toolkits.  I also have upgraded my physical hardware and my operating system since this bug was filed.  I am running today's latest tip (11/6/18).


>> graphics_toolkit
ans = qt
>> tst_slowprint
Elapsed time is 0.232625 seconds.
>> tst_slowprint
Elapsed time is 0.190336 seconds.
>> graphics_toolkit fltk
>> close all
>> tst_slowprint
Elapsed time is 4.79731 seconds.
>>


However, running tst_slowprint2 which doesn't involve ghostscript the times were about the same, but not exactly fast.


>> graphics_toolkit qt
>> tst_slowprint2
Elapsed time is 4.34872 seconds.
>> graphics_toolkit fltk
>> tst_slowprint2
Elapsed time is 4.4148 seconds.
>>




Rik <rik5>
Group administrator
Tue 06 Nov 2018 12:56:42 PM UTC, comment #15: 

@muhali: Is this still an issue for you? I don't observe the slowdown anymore, but in the mean time I have changed my OS and driver.

Pantxo Diribarne <pantxo>
Group Member
Wed 06 Dec 2017 10:00:23 AM UTC, comment #14: 

I wonder what caused this behaviour. I don't think I saw it half a year ago, neither in stable nor in dev, with the same or similar data.

Muhali <muhali>
Tue 05 Dec 2017 06:45:20 PM UTC, comment #13: 

Rik: octave ver was current dev.

Michael Godfrey <godfrey>
Group Member
Tue 05 Dec 2017 06:37:44 PM UTC, comment #12: 

Rik:  Relative fltk vs. qt seems to depend on the system.

[godfrey@pbdsl4 plot_timing]$ oct
octave:1> tst_slowprint2
Elapsed time is 2.48103 seconds.
octave:2> tst_slowprint
Elapsed time is 2.38323 seconds.
octave:3> graphics_toolkit
ans = fltk
octave:4> graphics_toolkit('qt')
octave:5> tst_slowprint2
Elapsed time is 2.26857 seconds.
octave:6> tst_slowprint
Elapsed time is 2.51041 seconds.
octave:7> graphics_toolkit
ans = qt
octave:8> quit
[godfrey@pbdsl4 plot_timing]$ uname -a
Linux pbdsl4 4.13.16-302.fc27.x86_64 #1 SMP Thu Nov 30 15:33:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Michael Godfrey <godfrey>
Group Member
Tue 05 Dec 2017 06:28:18 PM UTC, comment #11: 

I'm running KDE.  I tried turning off anti-aliasing with


set (gcf, 'graphicssmoothing', 'off')


but it made no difference.  FLTK was just way slower than QT.  I modified the test script to use eps so that there is no ghostscript involvement.  I've uploaded that script as tst_slowprint2.m.  This also made no difference on my system.


(file #42574)

Rik <rik5>
Group administrator
Tue 05 Dec 2017 06:08:18 PM UTC, comment #10: 

Here are the times with the original data file:

octave:1> graphics_toolkit qt
octave:2> load foo.ot
octave:3> plot(u, F, ".") ;
octave:4> tic; print t1.eps; toc
Elapsed time is 8.83654 seconds.

octave:1> graphics_toolkit fltk
octave:2> load foo.ot
octave:3> plot(u, F, ".") ;
octave:4> tic; print t1.eps; toc
Elapsed time is 8.77279 seconds.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 05 Dec 2017 06:05:59 PM UTC, comment #9: 

I have similar results with the original (times about the same).
I wonder if the results are due to the environment.
Are you using KDE desktop? may be some anti-aliasing settings
would affect qt backend but not fltk. (I am on gnome).

Note i also timed .eps file to avoid ghostscript involvement.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Tue 05 Dec 2017 06:00:16 PM UTC, comment #8: 

@Dmitri: Interesting.  The original file had ~20,000 points.  Maybe you could try adjusting the number of points to see if there are breakpoints, such as 1024, 4096, 8192, where the performance between FLTK and QT is different.  That might be a clue to where the problem lies.

Rik <rik5>
Group administrator
Tue 05 Dec 2017 05:03:29 PM UTC, comment #7: 

I get pretty much identical times:

octave:1> graphics_toolkit qt
octave:2> x = linspace (0,1, 1e3);
octave:3> plot (x,x, '.')
octave:4> tic; print t1.eps; toc
Elapsed time is 0.635007 seconds.
...
octave:1> graphics_toolkit fltk
octave:2> x = linspace (0,1, 1e3);
octave:3> plot (x,x, '.')
octave:4> tic; print t2.eps; toc
Elapsed time is 0.637315 seconds.
octave:5> _octave_config_info_ ("hg_id")
ans = 8b14ba8296af

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 05 Dec 2017 04:42:33 PM UTC, comment #6: 

In order to make progress we probably need to go through the engineering cycle of design/build/test.  And the number of iterations through that cycle is limited if it takes 15 minutes to test each new change.

A simpler example of the problem is


x = linspace (0,1, 1e3);
plot (x,x, '.')
tic; print foo.png; toc


This takes 8 seconds on the development branch with FLTK, and 0.5 second with QT.  I've attached the m-file as tst_slowprint.m.


(file #42573)

Rik <rik5>
Group administrator
Tue 05 Dec 2017 03:51:51 PM UTC, comment #5: 

Interestingly, the performance is very dependent on the backend.  With the qt backend, printing completes in 2.5 seconds.  With the FLTK backend, printing takes 171 seconds.  This was on the development branch with cset


changeset:   24347:222addbadf46
user:        Torsten <mttl@mailbox.org>
date:        Sun Dec 03 12:37:13 2017 +0100
summary:     fix truncated startup message in the gui terminal


I don't really understand why that would be since both qt and fltk rely on OpenGL underneath and gl2ps for printing.

Rik <rik5>
Group administrator
Tue 05 Dec 2017 10:10:07 AM UTC, comment #4: 

I can confirm that printing with a large number of markers is very slow. On my computer though, with the address sanitizer enabled and debug symbols, the dev version is much slower than what you report: ~320s with either "o" or ".".

Unfortunately, each marker is drawn using a fixed number of lines, that depends on the marker type, and/or with an undefined (opengl driver dependent) number of triangles. With this approach, I can't see any easy improvement since gl2ps will always have to treat (eventual depth sort/write) each primitive.

Changing title to better describe the actual issue and changing status to "confirmed".


Pantxo Diribarne <pantxo>
Group Member
Tue 05 Dec 2017 05:05:43 AM UTC, comment #3: 

I guess I was impatient:

With dev:

octave:5> tic ; print t1.png ;toc
Elapsed time is 10.0654 seconds.
octave:6> tic ; print t1.eps ;toc
Elapsed time is 8.80283 seconds.

with 4.2.1:

octave:4> tic ; print t1.eps ;toc
Elapsed time is 472.672 seconds.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 05 Dec 2017 04:38:28 AM UTC, comment #2: 

This works for me, although I will say it is very, very slow.


octave:1> graphics_toolkit
ans = qt
octave:2> load foo.ot
octave:3> plot (u,F, ".");
octave:4> tic; print ('foo.png'); toc
Elapsed time is 953.391 seconds.


That was with 4.2.1.  On the development branch the time was 154 seconds which is still really long.

Rik <rik5>
Group administrator
Mon 04 Dec 2017 07:13:15 PM UTC, comment #1: 

Confirm with 4.2.1 on Fedora 27
(also hangs printing to svg, eps).
Both qt and fltk are affected.

Works in a recent dev.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Mon 04 Dec 2017 04:59:33 PM UTC, original submission:  

Doing


graphics_toolkit qt
load foo.ot
plot(u, F, ".") ;
print foo.png


using the attached file foo.ot, makes octave hang.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #42574:  tst_slowprint2.m added by rik5 (65B - text/x-matlab)
file #42573:  tst_slowprint.m added by rik5 (65B - text/x-matlab)
file #42566:  foo.ot added by muhali (802KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by muhali (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-11 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-11-06 rik5 Release4.2.1 dev
    2017-12-05 rik5 Attached File- Added tst_slowprint2.m, #42574
    2017-12-05 rik5 Attached File- Added tst_slowprint.m, #42573
    2017-12-05 pantxo Item GroupNone Performance
        StatusWorks For Me Confirmed
        Summaryoctave hangs after print Printing with many markers is very slow
    2017-12-05 rik5 StatusNone Works For Me
    2017-12-04 muhali Attached File- Added foo.ot, #42566

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code