The International Simutrans Forum

 

Author Topic: Large convoi (and other lists) almost unresizable  (Read 621 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10565
  • Languages: De,EN,JP
Large convoi (and other lists) almost unresizable
« on: November 25, 2020, 01:05:58 PM »
Opening a convoi list with many entries (like the yoshi http://www.physik.tu-berlin.de/~prissi/simutrans/yoshi87-2-102.sve testgame) freezes the game a long time and makes window resizing almost impossible. I tried chacing of get_min_size and get_max_size of gui_convoiinfo.cc but without luck. Still for every resizing the container calculates for each convoi again get_min_size (seen by calling gui_convoi_images_t::get_min_size()) and ignopres the overridden get_min_size().

I admid, I am confused why this happens and gave up. Any hint are greatlz appreciated.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Large convoi (and other lists) almost unresizable
« Reply #1 on: November 25, 2020, 02:07:12 PM »
This is how it is implemented :/ gui_aligned_container_t::set_size calls get_min/max_size for all children, then set_size for all. If one of these children is another container, then its children get multiple get_min/max_size calls. Nothing is cached. I think one can implement some caching at least for one call to window resizing. I will try.

It seems to be exceptionally worse for these convoi-images. They are at level 4 of nested tables, so one call to window-resize will process each convoi-image object several times.

Which overridden get_min_size are ignored?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Large convoi (and other lists) almost unresizable
« Reply #2 on: November 25, 2020, 08:53:17 PM »
Did some small changes in r9442 & 9443. Still the problem with these large lists persists.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10565
  • Languages: De,EN,JP
Re: Large convoi (and other lists) almost unresizable
« Reply #3 on: November 26, 2020, 05:33:04 AM »
Unfortunately, with these cahnges the modal pak set selector at the beginning does no longer show up and simutrans freezes.

Maybe a gui_aligned_container_t should cache its min/max size unless there was a draw or an add/remove component call. Because the five tabs in the convoi list have all the same container but it seems that it is called five times when resizing. This of course implies to remove the const from all get_min_size() calls.

Or at least teh scrollpane should cache the minimum size before each draw event. Now even updating the slider seems to call the scrollpane in all tabs.
« Last Edit: November 26, 2020, 07:04:10 AM by prissi »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Large convoi (and other lists) almost unresizable
« Reply #4 on: November 26, 2020, 06:35:18 AM »
Pak-selector is fixed in r9448, calls to duplicate components are caught in r9449.  Still the list is not as reactive as it should be. Edit: with optimized build it is acceptable.

What do you mean with "Now even updating the slider seems to call the scrollpane in all tabs." ?

I tried caching some stuff within gui_aligned_container, but it did not work. Scrolled lists appeared empty.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10565
  • Languages: De,EN,JP
Re: Large convoi (and other lists) almost unresizable
« Reply #5 on: November 26, 2020, 07:07:33 AM »
Ok, heavy EDIT!

I tried also some caching. I noticed that during one resize event before the next draw the gui_scrollpane_t::set_size is called 20x times, but only 4 times after your optimisation. I think you did a good job already.

I noticed, clicking on the resize button (but not resizing) enlarged the convoi to the max width (seen by the loading bar).
« Last Edit: November 26, 2020, 07:24:25 AM by prissi »