Opened 13 months ago

#2858 new enhancement

UI updates related to results take significant time even when results tab is not shown

Reported by: gkronber Owned by:
Priority: medium Milestone: HeuristicLab 3.3.16
Component: Optimization.Views Version:
Keywords: Cc:

Description

Reproduce

  1. Open and run GA-TSP sample without showing the results. Execution time ~7sec
  2. Open and run GA-TSP sample showing the results tab. Execution time ~15sec
  3. Change AlgorithmView to never set the Content for the results tab. Execution time ~3sec
        protected override void OnContentChanged() {
          base.OnContentChanged();
          if (Content == null) {
            parameterCollectionView.Content = null;
            problemViewHost.Content = null;
            resultsView.Content = null;
            runsView.Content = null;
            storeAlgorithmInEachRunCheckBox.Checked = true;
          } else {
            parameterCollectionView.Content = Content.Parameters;
            problemViewHost.ViewType = null;
            problemViewHost.Content = Content.Problem;
    -->     //   resultsView.Content = Content.Results.AsReadOnly();
            runsView.Content = Content.Runs;
            storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
          }
        }
    

A solution would be to check which tab is currently active and set the content to null for each ViewHost which is currently not visible. A sketch is given below. Additionally, it would be necessary to also update all embedded ViewHosts, especially the ViewHost showing the value of the selected result.

protected override void OnContentChanged() {
  base.OnContentChanged();
  if (Content == null) {
    parameterCollectionView.Content = null;
    problemViewHost.Content = null;
    resultsView.Content = null;
    runsView.Content = null;
    storeAlgorithmInEachRunCheckBox.Checked = true;
  } else {
    if (tabControl.SelectedTab == problemTabPage) { problemViewHost.Content = Content.Problem; } 
    else if (tabControl.SelectedTab == parametersTabPage) { parameterCollectionView.Content = Content.Parameters; } 
    else if (tabControl.SelectedTab == resultsTabPage) { resultsView.Content = Content.Results.AsReadOnly(); }
    else if (tabControl.SelectedTab == runsTabPage) { runsView.Content = Content.Runs; }
    storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
  }
} 

...

private void tabControl_Selected(object sender, TabControlEventArgs e) {
  if (Content == null) return;
  if (e.TabPage == problemTabPage) { problemViewHost.Content = Content.Problem; }
  else if(e.TabPage == parametersTabPage) { parameterCollectionView.Content = Content.Parameters; }
  else if(e.TabPage == resultsTabPage) { resultsView.Content = Content.Results.AsReadOnly(); }
  else if(e.TabPage == runsTabPage) { runsView.Content = Content.Runs; }
}

Change History (0)

Note: See TracTickets for help on using tickets.