bugGNU Octave - Bugs: bug #56081, quiver and set() many...

 
 

bug #56081: quiver and set() many data/property fields is inneficient with many listeners

Submitted by:  SillyMon <sillymon>
Submitted on:  Fri 05 Apr 2019 10:51:47 PM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  None Assigned to:  None
Originator Name:  SillyMon Open/Closed:  Open
Release:  4.4.1 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 11 Apr 2019 06:33:43 PM UTC, comment #1:

Can you upload the m-file you used for benchmarking?  That would help.

The set command operates, as you would expect, with an internal for loop over the arguments so

set (h, "udata", u, "vdata", v)

is equivalent to

set (h, "udata", u)
set (h, "vdata", v)

The update_data callback is particularly long, as callbacks go, because the plotted values (like arrowhead) are a resonably complicated function which depends on x, y, z, u, v, and w.  If you see a way to reduce the complexity, i.e., a rewrite, I can review any patch.

There is no explicit way to to disable listeners, as in disable interrupts for a section of code, and then re-enable them.

You might be able to fashion something by adding a property like "__update__" and using

set (h, "__update__", "off", "udata", u, "vdata", v, "__update__", "on")

where the actual calculation of arrows is triggered only by the "off" to "on" transition of "__update__".

Rik <rik5>
Project Administrator
Fri 05 Apr 2019 10:51:47 PM UTC, original submission:

_quiver_ sets a listener for all the data fields x/y/z/u/v/wData of the quiver handle to update_data(h,~) when a change to the fields are made.
set(h, 'xData', 'yData') or more data variables or props trigers the same callback functions update_data or update_props for every single data/prop field being changed in one use of set.

this makes the updating of one single arrow take approx 0.1 sec, this is to slow. Updating the position and size of a arrow constructed of 10 patches is faster, almost 10 times faster. While quiver only uses 3 lines for a arrow as far as i have looked.

There is no reason to run the update_data/props functions more than once for each instance of set().
or at least there should be a way for the user to turn off and on the listeners and decide when all new data is ready for update.
but update_data/props is local to _quiver_. testing gave a improvement to 0.05 sec for

    %addlistener (hg, "xdata", @update_data);
    %addlistener (hg, "ydata", @update_data);
    addlistener (hg, "zdata", @update_data);
    %addlistener (hg, "udata", @update_data);
    %addlistener (hg, "vdata", @update_data);
    addlistener (hg, "wdata", @update_data);

other plotting functions seem to have the update_data part of the code built in to octave.

the _quiver_.m functions has many calculations repeated many times. fast code dose not seem to have been of any concern in this implementation and much of it seems like ripe, low hanging fruit for a rewrite.

Is there any way to tell octave that it should wait for more data before it starts preparing for drawing/reacts to changes in the fields of a graphics handle?

SillyMon <sillymon>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sillymon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-11 rik5 Operating SystemMicrosoft Windows => Any
        Summaryquiver and set() many data/property fields is ineficient with many listeners => quiver and set() many data/property fields is inneficient with many listeners

    Back to the top


    Powered by Savane 3.4