Ticket #704 (closed defect: fixed)

Opened 13 months ago

Last modified 4 months ago

Avoid creation of unnecessary views on startup

Reported by: markus Owned by: george
Priority: critical Milestone: GeoGebra 4.0
Component: Kernel Keywords:
Cc: george, florian Estimate (h): 0
Progress (%): 100

Description

Startup of GeoGebra is currently very slow. I think this is can be improved by making sure that unnecessary views are not created.

  • 2nd EuclidianView should not be created and not attached to the kernel on startup (unless needed)
  • TextPreviewPanel should not be created and not attached to the kernel on startup. Why is this view attached to the kernel at all?

Apart from the initial time needed to create these views, each attached kernel view will get all updates from the kernel and thus potentially slow down the overall performance of GeoGebra. I suggest to only create (and attach) these views when really necessary.

Florian knows the GUI mechanisms best, but I will be happy to help. Thanks!

Change History

comment:1 Changed 13 months ago by michael

  • Cc george added

comment:2 Changed 13 months ago by florian

  • Cc florian added; michael removed
  • Status changed from new to assigned
  • Component changed from GUI to Kernel
  • Owner changed from florian to michael

The layout manager is implemented in such a way that views are requested on demand, ie just if they are visible, not at startup. Adding views to the layout manager alone should therefore not decrease performance significantly.

In detail: The methods DockPanel::loadStyleBar() and DockPanel::loadComponent() are called if the view is made visible the first time. A typical implementation would be like in geogebra.gui.layout.panels.Euclidian2DockPanel, where the method call GuiManager::getEuclidianView2() would initialize the view.

2nd EuclidianView should not be created and not attached to the kernel on startup (unless needed)

Therefore the problems you're mentioning are not directly related to the GUI. It's more a problem of file loading: If there is a XML tag for the second EV (not the one which is part of the layout manager, but the one storing the grid settings etc.) or if any object is visible in the second EV the view is initialized automatically (in other words: always).

My suggestions to fix this:

  • If the second EV is not already initialized store EV2 settings in a container and apply them if GuiManager::getEuclidianView2() is called.
  • Use the view IDs (static attributes of Application) for the GeoElement::viewSet container, not the actual views objects.

I assigned this ticket to Mike now as he implemented the XML loading of the second EV, but George implemented the text preview panel, so maybe he can make that panel update it's object list on demand only.

comment:3 follow-up: ↓ 5 Changed 13 months ago by michael

I've made this change for EV2 (but I still need to check if making a Point appear in EV2 is enough to create the view)
http://www.geogebra.org/trac/changeset/9494

comment:4 Changed 13 months ago by michael

Stopped 2nd EV being created when Object Properties opened:
http://www.geogebra.org/trac/changeset/9510

comment:5 in reply to: ↑ 3 Changed 13 months ago by michael

Replying to michael:

I've made this change for EV2 (but I still need to check if making a Point appear in EV2 is enough to create the view)
http://www.geogebra.org/trac/changeset/9494

In fact the Location -> Graphics / Graphics 2 options are hidden unless EV2 is showing which seems fine

comment:6 Changed 13 months ago by michael

I think we need to make sure that:

  • TextPreviewPanel is created only when the Text panel is first opened
  • it is detached when Object Properties is closed
  • it is detached when the Text Tool dialog is closed

Also if we could create just one instance and use that in both places, I think that would be good.

comment:7 Changed 13 months ago by michael

  • Owner changed from michael to george

comment:8 Changed 13 months ago by george

TextPreviewPanel has been changed so that it does not attach to the kernel.

Two instances of the panel are needed, one for the properties dialog and another for the text editor dialog. Under the current design the dialogs cannot share one instance since it is possible for both to be visible at once.

comment:9 Changed 4 months ago by michael

  • Status changed from assigned to closed
  • Progress (%) changed from 0 to 100
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.