bugGNU Octave - Bugs: bug #55418, Speed issue with uicontrols

 
 

bug #55418: Speed issue with uicontrols

Submitter:  Guillaume <gyom>
Submitted:  Tue 08 Jan 2019 11:41:51 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 15 Jul 2021 11:03:20 AM UTC, comment #6: 

@Pantxo: Sorry, it has taken so long.
I didn't find any documentation about this. But afaict all(?) graphics properties might be asynchronous in Matlab.
If a user wants to get properties after setting (the same or other) properties, a `drawnow` might be required to reliably get the updated values.

Markus Mützel <mmuetzel>
Group administrator
Sat 14 Nov 2020 11:33:49 PM UTC, comment #5: 

@Markus: Is it documented which properties need a drawnow before they are accurate in ML?

Since comment #3 the uicontrol extent property has been implemented entirely in the interpreter thread (doesn't require any interaction with the GUI), but as I remember other properties need to be retrieved from the GUI (figure position and outerposition at least).

Pantxo Diribarne <pantxo>
Group Member
Sat 14 Nov 2020 09:45:58 AM UTC, comment #4: 

IIRC, Matlab needs the user to call `drawnow` (or `pause` with a short delay) explicitly for properties like "Extent" to be correct immediately after creating a graphics object.
Maybe we could require something similar and make updating these values asynchronous?

Markus Mützel <mmuetzel>
Group administrator
Wed 09 Jan 2019 07:54:30 AM UTC, comment #3: 

The main problem is that some properties rely on the the widget being actually built to be correct. Lets take an example: suppose the extent property of uicontrol objects would work properly :-), i.e. computed and set from the GUI thread once the string is parsed and displayed by Qt.


h = uicontrol ("style", "text", "My string is long and I would lke to know if it fits in one line");
ext = get (h, "extent");


If I wait for a drawnow before creating the uicontrol, then ext will be wrong since the widget has not been created at the time the "extent" is queried.

This problem is tricky and I'll take a look at it once Octave 5 is released.

Pantxo Diribarne <pantxo>
Group Member
Tue 08 Jan 2019 06:06:35 PM UTC, comment #2: 

Thanks for the feedback; I prefer reliable to fast. I marked it as regression but that's something to look at after the 5.0 release. That said, can you think of ways to accelerate it? For example, would it help if a redraw was only performed at the end of the sequence?

Guillaume <gyom>
Tue 08 Jan 2019 03:22:20 PM UTC, comment #1: 

Confirmed, the whole sequence takes ~1s in Octave 4.4.1 while it takes ~5s in Octave 5.
This is most probably due to the fact that Widgets are now created synchronously (the interpreter waits for Widget n to be created in the GUI thread before creating Widget n+1). This change made the Qt toolkit much more reliable but also much slower for creation/deletion of GUI elements.

Pantxo Diribarne <pantxo>
Group Member
Tue 08 Jan 2019 11:41:51 AM UTC, original submission:  

I notice a significant difference in speed between 4.4.1 and 5.0.1 when displaying and deleting uicontrols. The following script runs nearly instantaneously in Matlab and Octave 4.4.1 but is much slower with current Octave dev.


h = figure ();
for i=0.02:0.08:0.94
    for j=0.02:0.08:0.94
        uicontrol (...
            "Parent", h, ...
            "Units", "normalized", ...
            "Position", [i j 0.06 0.06]);
    end
end
delete (findobj (h, "Type", "uicontrol"));


Guillaume <gyom>

 

(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 mmuetzel (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by gyom (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-11-14 mmuetzel Operating SystemGNU/Linux Any
    2019-01-08 pantxo StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code