Performance Issues when Scale isn't 1.0
Scott Palmer
swpalmer at gmail.com
Fri Sep 21 11:53:04 PDT 2012
I have confirmed that the issue is caused by ScrollPane:
It is related to RT-11253
I have the following in my code:
// Wrapping in a group is necessary to have ScrollPane work on visual bounds instead of layout bounds
// see http://javafx-jira.kenai.com/browse/RT-11253
Group myDocumentGroup = getGraphDocumentGroup();
Group scrollGroup = new Group();
scrollGroup.getChildren().add(myDocumentGroup)
scrollPane = new ScrollPane();
scrollPane.setFitToHeight(false);
scrollPane.setFitToWidth(false);
scrollPane.setContent(scrollGroup);
contentAnchorPane.getChildren().add(scrollPane);
AnchorPane.setTopAnchor(scrollPane,0.0);
AnchorPane.setLeftAnchor(scrollPane,0.0);
AnchorPane.setBottomAnchor(scrollPane,0.0);
AnchorPane.setRightAnchor(scrollPane,0.0);
If I remove the ScrollPane and place my document view directly in my AnchorPane the performance issue goes away.
It seems that when the scale is not 1.0 ScrollPane take a long time to compute the bounds of the content or something like that.
I will see if I can whip up a test case.
Scott
On 2012-09-21, at 2:12 PM, Scott Palmer <swpalmer at gmail.com> wrote:
> Hi Brent,
>
> Yes, that is correct, even when the zoom results in less being drawn performance drops.
>
> It so happens that I had a go at making this into a Stage-based "pure" JavaFX application. I hand
> t tried that code in a while, as there is a lot more to do to migrate the entire app, but what we have in our JFXPanel is mostly functional.
>
> Here's the bad news. Performance in the Stage based app is even worse! I use CTRL+MOUSE_WHEEL for zoom. In the JFXPanel version the zoom is relatively smooth (we actually animate it a bit via JavaFX to go from one zoom level to another). In JavaFX I see the zoom happen at about 1 frame per second!. Dragging the components is at least as bad as with a JFXPanel, but I'm pretty sure it is worse. I don't quite get how that can be.
>
> I'm going to do more investigation, as I now suspect an interaction with the scroll pane. The JFX GUI also has two versions of the document that are always zoomed out and not part of the scroll pane - basically to give a birds-eye view of the entire document. They don't seem to have any effect on the performance.
>
>
> Thanks,
>
> Scott
>
> On 2012-09-21, at 1:05 PM, Brent Christian <brent.christian at oracle.com> wrote:
>
>> Hi, Scott
>>
>> I'm not aware of any performance issues specific to scaling.
>>
>> You say the problem happens when you zoom in *or* out, so I assume it's not simply a matter of increased complexity in the visible portion of the graph.
>>
>> I would be interested to know if performance is different with the UML diagram placed in a Stage instead of a JFXPanel.
>>
>> I'm guessing a new JIRA will need to be filed.
>>
>> Thanks,
>> -Brent
>>
>> On 9/21/12 7:51 AM, Scott Palmer wrote:
>>> I've searched Jira and didn't find anything. Is there a known issue with scaling causing significant performance degradation?
>>> I have an application that renders something like a UML diagram in a JFXPanel. Basically it looks like a bunch of rectangles connect by lines. I can grab and drag those rectangles to layout the document, which can be rather large. I can also drag new connections between the boxes. This all works smoothly, until I try to "zoom" in or out on the diagram.
>>>
>>> If I set a single X & Y scale factor on the parent node of my diagram so that I can see more of it (it's in a scrollpane too), that makes the performance plummet when I drag the boxes or try to drag a new Path to make a connection. It's at least 5 times slower I figure. The user experience is horrible as I get less than 5 fps at times vs. 30+ with the scale set to 1.0
>>>
>>> I know there is ongoing work with performance, I just wondered if this is a known issue in 2.2.0 (Jira #?). I would file a bug, but it would take a while to isolate a test case from my current app.
>>>
>>> Regards,
>>>
>>> Scott
>>>
>
More information about the openjfx-dev
mailing list