r语言 - 是否有一种方法来检查闪亮应用程序的速度



我有一个非常简单的应用程序在我的本地。在shiny server pro上也部署了相同的功能。但是我看到了执行速度的不同。本地的非常快,但是部署在闪亮服务器上的很慢。不知道为什么。两者代码相同

所以我的客户想问我们是否可以量化应用程序的速度。我们能做到吗?

library(shiny)
ui <- fluidPage(
sliderInput("x", "If x is", min = 1, max = 50, value = 30),
sliderInput("y", "and y is", min = 1, max = 50, value = 5),
"then, (x * y) is", textOutput("product"),
"and, (x * y) + 5 is", textOutput("product_plus5"),
"and (x * y) + 10 is", textOutput("product_plus10")
)
server <- function(input, output, session) {
output$product <- renderText({ 
product <- input$x * input$y
product
})
output$product_plus5 <- renderText({ 
product <- input$x * input$y
product + 5
})
output$product_plus10 <- renderText({ 
product <- input$x * input$y
product + 10
})
}
shinyApp(ui, server)

看一下Profvis包。在您的示例中,没有太多要检查的,但您可以使用provfis作为profvis::profvis(runApp(shinyApp(ui, server))):

运行应用程序。
library(shiny)

ui <- fluidPage(
sliderInput("x", "If x is", min = 1, max = 50, value = 30),
sliderInput("y", "and y is", min = 1, max = 50, value = 5),
"then, (x * y) is", textOutput("product"),
"and, (x * y) + 5 is", textOutput("product_plus5"),
"and (x * y) + 10 is", textOutput("product_plus10")
)
server <- function(input, output, session) {
output$product <- renderText({ 
product <- input$x * input$y
product
})
output$product_plus5 <- renderText({ 
product <- input$x * input$y
product + 5
})
output$product_plus10 <- renderText({ 
product <- input$x * input$y
product + 10
})
}
profvis::profvis(runApp(shinyApp(ui, server)))

最新更新