[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47455] very slow legend execution
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #47455] very slow legend execution |
Date: |
Tue, 19 Nov 2019 13:40:31 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Follow-up Comment #5, bug #47455 (project octave):
The changing of legend properties, particularly with set(), is now much
faster. It is the code that uses subplots that is particularly slow. I
extracted a benchmark test where I turn on profiling.
profile clear
clf;
x = (1:5)';
subplot (2,2,1);
plot (x, rand (numel (x)));
profile resume
legend (cellstr (num2str (x)), "location", "northwestoutside");
profile off
subplot (2,2,2);
plot (x, rand (numel (x)));
profile resume
legend (cellstr (num2str (x)), "location", "northeastoutside");
profile off
subplot (2,2,3);
plot (x, rand (numel (x)));
profile resume
legend (cellstr (num2str (x)), "location", "southwestoutside");
profile off
subplot (2,2,4);
plot (x, rand (numel (x)));
profile resume
legend (cellstr (num2str (x)), "location", "southeastoutside");
profile off
Using profexplore, it is clear that only two functions (update_layout_cb and
axes) are responsible for most of the time consumed.
Top
legend: 4 calls, 0.545 total, 0.006 self
1) legend>update_layout_cb: 4 calls, 0.354 total, 0.004 self
2) axes: 4 calls, 0.118 total, 0.001 self
3) __go_text__: 4 calls, 0.021 total, 0.021 self
4) legend>add_safe_listener: 28 calls, 0.014 total, 0.002 self
5) legend>parse_opts: 4 calls, 0.010 total, 0.003 self
6) legend>addproperties: 4 calls, 0.009 total, 0.002 self
7) legend>update_numchild_cb: 4 calls, 0.003 total, 0.001 self
8) setappdata: 8 calls, 0.003 total, 0.002 self
9) addlistener: 64 calls, 0.002 total, 0.002 self
10) ancestor: 4 calls, 0.001 total, 0.001 self
Within update_layout_cb, it is the function textitem_objects and set() that
take the most time. It might be possible to coalesce the set() calls in to
fewer invocations (< 56 currently) which might help.
legend: 4 calls, 0.545 total, 0.006 self
legend>update_layout_cb: 4 calls, 0.354 total, 0.004 self
1) legend>textitem_objects: 4 calls, 0.177 total, 0.019 self
2) set: 56 calls, 0.121 total, 0.087 self
3) legend>update_legend_position: 4 calls, 0.033 total, 0.003 self
4) legend>textitem_data: 4 calls, 0.013 total, 0.004 self
5) setappdata: 8 calls, 0.002 total, 0.001 self
Within textitem_objects, I see
legend>textitem_objects: 4 calls, 0.177 total, 0.019 self
1) __go_line__: 40 calls, 0.070 total, 0.070 self
2) linkprop: 40 calls, 0.038 total, 0.026 self
3) __go_text__: 20 calls, 0.030 total, 0.030 self
4) setappdata: 40 calls, 0.009 total, 0.006 self
5) get: 76 calls, 0.004 total, 0.004 self
6) legend>update_marker_cb: 20 calls, 0.001 total, 0.001 self
There are 10 calls to __go_line__ per invocation even though there are only 5
legend objects. Maybe we don't need to place a marker object if there is no
marker to begin with?
(file #47902)
_______________________________________________________
Additional Item Attachment:
File name: bm_leg25.m Size:0 KB
<https://savannah.gnu.org/file/bm_leg25.m?file_id=47902>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?47455>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/