Suppose there is a busy site that executes a 5s calculation when a user clicks a button. We know that R is single threaded, so if it's busy working on user_1's calculation, user_2 must wait.
{mirai} is a minimalist async evaluation framework for R.
I'm wondering whether mirai will automatically distribute each individual users calculation over the number of cores that a machine has so as to minimize wait time.
The calculations of each of user are independent from one another.
library(shiny)
library(mirai)
daemons(2)
ui <- fluidPage(
)
server <- function(input, output, session) {
observeEvent(input$button, {
call_mirai(
takes_a_few_sec(a, b, c)
)
}
}
shinyApp(ui, server)