It took 20-25 seconds to see "Upload Complete" when I upload a 30 MB csv file in Shiny.
The upload bar completes almost instantaneously. The "Upload Complete" takes another 20 seconds to show up.
According to https://stackoverflow.com/questions/54586226/r-shiny-fileinput-displays-upload-completed-a-few-seconds-before-it-is-actual, the upload bar measures the time to upload the file into the temp directory. Not the time to read it into memory.
Thus, it looks like it takes 20 seconds for it to read my data into memory. Any idea how to speed this up?
My code is very simple:
app.R
library(shiny)
options(shiny.maxRequestSize = 50*1024^2)
server <- function(input, output, session) {
rawdata <- shiny::eventReactive (input$inFile, {
rdata <- capture.output(data.table::fread(input$inFile$datapath, header=input$header, sep=",", data.table = F, verbose = T))
})
}
ui <- fluidPage(
titlePanel("title panel"),
sidebarLayout(
sidebarPanel("sidebar panel",
shiny::fileInput(inputId = "inFile", "Choose a CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv"
)
),
shiny::checkboxInput("header", "Header", TRUE)),
mainPanel("main panel")
)
)
shinyApp(ui,server)