Skip to content

Dashboard speed optimization by reducing redundant plot function calls #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 26, 2022

Conversation

rafaelcatoia
Copy link
Contributor

@rafaelcatoia rafaelcatoia commented May 10, 2022

Because of how reactivity in shiny works, there were many redundant calls.

Every time that we update a reactive variable, it automatically triggers functions that depends on this reactive variable. For example: changing input$targetVariable triggers summaryPlot, so there is no need

In this PR we removed some of those forced calls of functions that would already be triggered by reactivity.

For example, when changing colours, there is no need to call summaryPlot since it will alread be triggered by the change of the reactive variable COLOR_SEED()

Here is an example of change that was made:

From:

  observeEvent(input$refreshColors, {
    COLOR_SEED(floor(runif(1, 1, 1000)))
    output$summaryPlot <- renderPlotly({
      summaryPlot()
    })
  })

to:

  observeEvent(input$refreshColors,
    {
      COLOR_SEED(floor(runif(1, 1, 1000)))
      USE_CURR_TRUTH <<- TRUE
    },
    ignoreInit = TRUE
  )

@rafaelcatoia rafaelcatoia requested a review from nmdefries May 10, 2022 19:16
Copy link
Collaborator

@nmdefries nmdefries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review with general comments. I didn't look at the logic in-depth yet and haven't tried running the dashboard myself. I'll plan to do a local build in docker to make sure the production version will work.

@nmdefries nmdefries self-requested a review May 24, 2022 19:13
@nmdefries nmdefries changed the title Dashboard minor fixex Dashboard speed optimization by reducing redundant plot function calls May 24, 2022
@nmdefries nmdefries marked this pull request as ready for review May 25, 2022 20:37
Copy link
Collaborator

@nmdefries nmdefries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the code changes look good and everything works in docker!

Before I merge this, could you describe in the PR what general changes you made? In the box that says "No description provided."

@nmdefries nmdefries merged commit b1115d3 into dev May 26, 2022
@nmdefries nmdefries deleted the dashboard-minor-fixex branch May 26, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants